unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: "Claes Wallin (韋嘉誠)" <clacke@lysator.liu.se>
Cc: 34279@debbugs.gnu.org
Subject: bug#34279: guix-install.sh: uses /bin/bash shebang
Date: Mon, 04 Feb 2019 22:26:03 +0100	[thread overview]
Message-ID: <87lg2vp7o4.fsf@gnu.org> (raw)
In-Reply-To: <CAGv_=Br6meZVGWf4-qNJ0P_f5W6_WOF-S2NsZ8mRdaJ4+Ey2gw@mail.gmail.com> ("Claes Wallin \=\?utf-8\?B\?KOmfi+WYieiqoCkiJ3M\=\?\= message of "Fri, 1 Feb 2019 16:35:56 +0100")

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

Hi,

Claes Wallin (韋嘉誠) <clacke@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:


[-- Attachment #2: Type: text/x-patch, Size: 805 bytes --]

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; }

[-- Attachment #3: Type: text/plain, Size: 21 bytes --]


Thanks,
Ludo’.

  reply	other threads:[~2019-02-04 21:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-01 15:35 bug#34279: guix-install.sh: uses /bin/bash shebang Claes Wallin
2019-02-04 21:26 ` Ludovic Courtès [this message]
2019-02-04 21:56   ` Ricardo Wurmus
2019-02-05 11:04   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lg2vp7o4.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=34279@debbugs.gnu.org \
    --cc=clacke@lysator.liu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).