Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid looping over single, constant value (codefactor.io/ShellCheck).
[simgrid.git] / tools / jenkins / build.sh
index 9518ae7..73fc613 100755 (executable)
@@ -12,8 +12,9 @@ export LC_ALL=C
 
 echo "XXXX Cleanup previous attempts. Remaining content of /tmp:"
 rm -rf /tmp/simgrid-java*
+rm -rf /var/tmp/simgrid-java*
 rm -rf /tmp/jvm-*
-find /builds/workspace/SimGrid/ -name "hs_err_pid*.log" | xargs rm -f
+find /builds/workspace/SimGrid/ -name "hs_err_pid*.log" -exec rm -f {} +
 ls /tmp
 df -h
 echo "XXXX Let's go"
@@ -26,7 +27,7 @@ fi
 
 # usage: die status message...
 die () {
-  local status=${1:-1}
+  status=${1:-1}
   shift
   [ $# -gt 0 ] || set -- "Error - Halting"
   echo "$@" >&2
@@ -72,14 +73,15 @@ elif [ -f /etc/debian_version ]; then
     os=Debian
     ver=$(cat /etc/debian_version)
 elif [ -f /etc/redhat-release ]; then
-    os=""
-    ver=$(cat /etc/redhat-release)
+    read -r os ver < /etc/redhat-release
 elif [ -f /usr/bin/sw_vers ]; then
     os=$(sw_vers -productName)
     ver=$(sw_vers -productVersion)
 elif [ -f /bin/freebsd-version ]; then
     os=$(uname -s)
     ver=$(freebsd-version -u)
+elif [ -f /etc/version ]; then
+    read -r os ver < /etc/release
 elif [ -f /etc/os-release ]; then
     # freedesktop.org and systemd, put last as usually missing useful info
     . /etc/os-release
@@ -189,7 +191,7 @@ else
   MAY_DISABLE_SOURCE_CHANGE="-DCMAKE_DISABLE_SOURCE_CHANGES=ON"
 fi
 
-if [ "$os" = "NixOS" -a "$(gcc -dumpversion)" = "7.4.0" ]; then
+if [ "$os" = "NixOS" ] && [ "$(gcc -dumpversion)" = "7.4.0" ]; then
     echo "Temporary disable LTO, believed to be broken on this system."
     MAY_DISABLE_LTO=-Denable_lto=OFF
 else