]> diplodocus.org Git - nmh/blobdiff - tools/showbuildenv
Change admonish(NULL, "foo") to inform("foo, continuing...").
[nmh] / tools / showbuildenv
index f5b4b3f7393f465063d2b6567beaf03d54587a20..81f278e86bd257b0a951c56738aa9616ac3fb926 100755 (executable)
@@ -5,21 +5,40 @@
 # build environment on machines they can't login on.  It also provides
 # a history in the build logs that might be useful in catching
 # regressions.
-# 
+#
 # This script should *only* report basic information about the build
 # environment, and only that necessary to reproduce the build
 # environment.
+#
+# The script's exit status must be zero if all went acceptably well as
+# buildbot checks for this and marks the `environment' stage as failed
+# otherwise.
 
 offset () {
-    sed -e '/./s/^/    /'
+    sed -e '/./s/^/    /' "$@"
 }
 
 header () {
     echo
-    echo $*
+    echo "$@"
     echo
 }
 
+# os-release is the new s*stemd standard.  Then it's the more unique
+# ones with redhat-release bringing up the rear because other platforms
+# also use that to placate broken logic that use its prescence as a
+# use-RPM test.
+for f in \
+    /etc/os-release /etc/arch-release /etc/debian_version \
+    /etc/fedora-release /etc/gentoo-release /etc/redhat-release \
+    /etc/lsb-release \
+    ; do
+    test -f $f || continue
+    header $f
+    offset $f
+    break
+done
+
 os=`uname`
 
 for i in a m p r s v; do
@@ -45,11 +64,8 @@ case ${os} in
        cc -v 2>&1 | offset
 
        header Installed packages:
+        #### pkg(7) or pkg_info(1) might not always be available.
        (pkg info 2>/dev/null | offset) || true
        (pkg_info 2>/dev/null | offset) || true
        ;;
-
-    Linux)
-        header Linux distribution:
-        (lsb_release -a 2>&1 | offset) || true
 esac