]> diplodocus.org Git - nmh/blobdiff - tools/showbuildenv
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
[nmh] / tools / showbuildenv
index 415c169dad3406d219e9b2b5b2a2541ed83be54f..4645049a6ae6db0538fb578969e8ba7fe67bafed 100755 (executable)
@@ -9,16 +9,35 @@
 # This script should *only* report basic information about the build
 # environment, and only that necessary to reproduce the build
 # environment.
+#
+# FIXME: Document meaning of script's exit status, if any.
+# It jumps through hoops with `|| true' despite not using `set -e'.
 
 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
@@ -28,7 +47,6 @@ done
 header Shell Variables:
 set | sort -d -t= | offset
 
-
 case ${os} in
 
   Darwin)
@@ -49,4 +67,7 @@ case ${os} in
        (pkg_info 2>/dev/null | offset) || true
        ;;
 
+    Linux)
+        header Linux distribution:
+        (lsb_release -a 2>&1 | offset) || true
 esac