guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/04: guix-install.sh: Avoid "#!/bin/bash" shebang.


From: guix-commits
Subject: 01/04: guix-install.sh: Avoid "#!/bin/bash" shebang.
Date: Tue, 5 Feb 2019 06:03:53 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit f5fdc54d3a0845d0590c181d3bd6016f22765431
Author: Ludovic Courtès <address@hidden>
Date:   Tue Feb 5 10:42:30 2019 +0100

    guix-install.sh: Avoid "#!/bin/bash" shebang.
    
    Fixes <https://bugs.gnu.org/34279>.
    Reported by Claes Wallin (韋嘉誠) <address@hidden>.
    
    * etc/guix-install.sh: Change shebang to #!/bin/sh and add 'if'
    statement to spawn Bash if needed.
---
 etc/guix-install.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 8eb5214..dc8de2f 100755
--- a/etc/guix-install.sh
+++ b/etc/guix-install.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 # GNU Guix --- Functional package management for GNU
 # Copyright © 2017 sharlatan <address@hidden>
 # Copyright © 2018 Ricardo Wurmus <address@hidden>
@@ -19,6 +19,13 @@
 # You should have received a copy of the GNU General Public License
 # along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
+# We require Bash but for portability we'd rather not use /bin/bash or
+# /usr/bin/env in the shebang, hence this hack.
+if [ "x$BASH_VERSION" = "x" ]
+then
+    exec bash "$0" "$@"
+fi
+
 set -e
 
 [ "$UID" -eq 0 ] || { echo "This script must be run as root."; exit 1; }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]