commit:     bc2b43acff4bb72ccd97324496d7f8b05f209167
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue May 31 11:10:09 2022 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue May 31 11:10:09 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=bc2b43ac

scripts/auto-bootstraps/dobootstrap: do some more guessing for Linux systems

try to deal with missing lsb_release, add case for Gentoo systems not to
include a "release"

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 scripts/auto-bootstraps/dobootstrap | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scripts/auto-bootstraps/dobootstrap 
b/scripts/auto-bootstraps/dobootstrap
index fd9bd75dd0..b4042a66e0 100755
--- a/scripts/auto-bootstraps/dobootstrap
+++ b/scripts/auto-bootstraps/dobootstrap
@@ -140,6 +140,18 @@ do_prepare() {
                        # UNIX vendors
                        local dist=$(lsb_release -si)
                        local rel=$(lsb_release -sr)
+                       if [[ -z ${dist} ]] || [[ -z ${rel} ]] ; then
+                               source /etc/os-release  # this may fail if the 
file isn't there
+                               [[ -z ${dist} ]] && dist=${NAME}
+                               [[ -z ${dist} ]] && dist=${ID}
+                               [[ -z ${rel} ]] && rel=${VERSION_ID}
+
+                               # Gentoo's versioning isn't really relevant, 
since it is
+                               # a rolling distro
+                               [[ ${dist,,} == "gentoo" ]] && rel=
+                       fi
+                       [[ -z ${dist} ]] && dist=linux
+                       # leave rel unset/empty if we don't know about it
                        while [[ ${rel} == *.*.* ]] ; do
                                rel=${rel%.*}
                        done

Reply via email to