Bug #308835: Support options in shebang and terminate 's' option of sed.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Sat, 7 Aug 2010 17:38:59 +0000 (19:38 +0200)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Sat, 7 Aug 2010 17:38:59 +0000 (19:38 +0200)
bin/ebuild.sh

index a68b9731fa52144879dda10fcdb284ed58688978..2affc923a38b7afe37b35e803663c6645fb28303 100755 (executable)
@@ -480,8 +480,8 @@ econf() {
        : ${ECONF_SOURCE:=.}
        if [ -x "${ECONF_SOURCE}/configure" ]; then
                if [[ -n $CONFIG_SHELL && \
-                       "$(head -n1 "$ECONF_SOURCE/configure")" =~ ^'#!'[[:space:]]*/bin/sh[[:space:]]*$ ]] ; then
-                       sed -e "1s:.*:#!$CONFIG_SHELL" -i "$ECONF_SOURCE/configure" || \
+                       "$(head -n1 "$ECONF_SOURCE/configure")" =~ ^'#!'[[:space:]]*/bin/sh([[:space:]]|$) ]] ; then
+                       sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \
                                die "Substition of shebang in '$ECONF_SOURCE/configure' failed"
                fi
                if [ -e /usr/share/gnuconfig/ ]; then