summary refs log tree commit diff
path: root/etc
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-02-05 10:42:30 +0100
committerLudovic Courtès <ludo@gnu.org>2019-02-05 12:03:24 +0100
commitf5fdc54d3a0845d0590c181d3bd6016f22765431 (patch)
tree8e1d4ed403ac85e6c815a8d1368787c7c4c94b91 /etc
parenta10050e2dd563188d6ae66f4de2eff10a5e65632 (diff)
downloadguix-f5fdc54d3a0845d0590c181d3bd6016f22765431.tar.gz
guix-install.sh: Avoid "#!/bin/bash" shebang.
Fixes <https://bugs.gnu.org/34279>.
Reported by Claes Wallin (韋嘉誠) <clacke@lysator.liu.se>.

* etc/guix-install.sh: Change shebang to #!/bin/sh and add 'if'
statement to spawn Bash if needed.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/guix-install.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/etc/guix-install.sh b/etc/guix-install.sh
index 8eb5214049..dc8de2fe92 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 <sharlatanus@gmail.com>
 # Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
@@ -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; }