GNU bug report logs -
#34279
guix-install.sh: uses /bin/bash shebang
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi,
Claes Wallin (韋嘉誠) <clacke <at> lysator.liu.se> skribis:
> This means ./guix-install.sh doesn't work on e.g. NixOS. :-)
>
> Please use /usr/bin/env bash.
/usr/bin/env wouldn’t work on Guix System by default. :-)
What about something like this:
[Message part 2 (text/x-patch, inline)]
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 <at> gmail.com>
# Copyright © 2018 Ricardo Wurmus <rekado <at> 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; }
[Message part 3 (text/plain, inline)]
Thanks,
Ludo’.
This bug report was last modified 6 years and 108 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.