diff --git a/GNUmakefile.in b/GNUmakefile.in index c1685fd..44f65dd 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -3,6 +3,7 @@ bindir = @bindir@ datarootdir = @datarootdir@ mandir = @mandir@ man1dir = $(mandir)/man1 +baseshell = @baseshell@ tests = $(testdir)/*.t @@ -47,7 +48,7 @@ fake: fake.tmp install -m 755 $< $@ fake.tmp: $(srcdir)/fake.in - sed -e 's:@basexy''@:$(basexy):' < $< > $@ + sed -e 's:@basexy''@:$(basexy):' -e 's:@baseshell''@:$(baseshell):' < $< > $@ fake.1: $(smandir)/fake.1.in cp $< $@ diff --git a/configure b/configure index 112feae..458f737 100755 --- a/configure +++ b/configure @@ -44,6 +44,7 @@ populate() # {{{ -e "s @datarootdir@ $datarootdir g" \ -e "s @mandir@ $mandir g" \ -e "s @basexy@ $basexy g" \ + -e "s @baseshell@ $baseshell g" \ $1 \ > $2 } # }}} @@ -58,9 +59,11 @@ bindir='$(prefix)/bin' datarootdir='$(prefix)/share' mandir='$(datarootdir)/man' mandir_set=0 +baseshell=/bin/sh for a in "$@"; do case $a in + --baseshell=*) baseshell="${a#*=}" ;; --bindir=*) bindir="${a#*=}" ;; --datarootdir=*) datarootdir="${a#*=}" ;; --mandir=*) @@ -68,7 +71,7 @@ for a in "$@"; do mandir_set=1 ;; --prefix=*) prefix="${a#*=}" ;; - --with-basexy=*) basexy="${a#*=}" ;; + --with-basexy=*) basexy="${a#*=}" ;; esac done diff --git a/s/fake.in b/s/fake.in index 6a874ea..d6c3623 100644 --- a/s/fake.in +++ b/s/fake.in @@ -1,4 +1,4 @@ -#!/bin/sh +#!@baseshell@ # vim: sw=2 sts=2 et fdm=marker cms=\ #\ %s set -e @@ -270,14 +270,14 @@ impl_has_body() # {{{ impl_passthrough() # {{{ { sed 's/^ *//' > "${1:?}" <<\EOF - #!/bin/sh + #!@baseshell@ exec "$ARGV0" "$@" EOF } # }}} impl_transparent() # {{{ { sed 's/^ *//' > "${1:?}" <<\EOF - #!/bin/sh + #!@baseshell@ argv0=$(command -v "$ARGV0") export PATH="$FAKE_BINDIR${PATH+:$PATH}" exec "$argv0" "$@" @@ -286,7 +286,7 @@ EOF impl_has_errout() # {{{ { { - printf -- "%s\n" "#!/bin/sh" + printf -- "%s\n" "#!@baseshell@" printf -- "%s\n" "cat >&${1:?} <<\\EOF" cat printf -- "%s\n" "EOF" @@ -295,7 +295,7 @@ impl_has_errout() # {{{ impl_reflect() # {{{ { sed 's/^ *//' > "${1:?}" <<\EOF - #!/bin/sh + #!@baseshell@ exec >&2 printf "%s" "${ARGV0##*/}" test $# -eq 0 || printf " %s" "$*" @@ -305,7 +305,7 @@ EOF impl_default() # {{{ { { - printf -- "%s\n" "#!/bin/sh" + printf -- "%s\n" "#!@baseshell@" } > "${1:?}" } # }}} @@ -330,7 +330,7 @@ test -z "$exitcode" || printf -- >> "$name" "exit %s\n" "$exitcode" chmod +x "$name" { - printf '#!/bin/sh\n\n' + printf '#!@baseshell@\n\n' sed -n '/^#### SHARED {{{/,/### SHARED }}}/p' < "$0" sed -n '/^#### BEGIN FRONTEND$/,$p' < "$0" | sed \ diff --git a/t/argv-0-files.t b/t/argv-0-files.t index 450e4dc..19ff2ae 100644 --- a/t/argv-0-files.t +++ b/t/argv-0-files.t @@ -17,4 +17,4 @@ test:: $ test -x $FAKE_BINDIR/.fubar/0- $ cat $FAKE_BINDIR/.fubar/0- - #!/bin/sh + #!*/sh (glob) diff --git a/t/argv-n-files.t b/t/argv-n-files.t index 5001a45..3bb7050 100644 --- a/t/argv-n-files.t +++ b/t/argv-n-files.t @@ -17,4 +17,4 @@ test:: $ test -x $FAKE_BINDIR/.fubar/2-/5KMMQRRICK======-EDQ7APJ6 $ cat $FAKE_BINDIR/.fubar/2-/5KMMQRRICK======-EDQ7APJ6 - #!/bin/sh + #!*/sh (glob) diff --git a/t/body-catchall-files.t b/t/body-catchall-files.t index ba631c1..9f1b197 100644 --- a/t/body-catchall-files.t +++ b/t/body-catchall-files.t @@ -20,5 +20,5 @@ test:: $ test -f $FAKE_BINDIR/.fubar/0+ $ test -x $FAKE_BINDIR/.fubar/0+ $ cat $FAKE_BINDIR/.fubar/0+ - #!/bin/sh + #!*/sh (glob) echo "hello ${1-unknown}!" diff --git a/t/body-files.t b/t/body-files.t index 8aa2e01..21c6b09 100644 --- a/t/body-files.t +++ b/t/body-files.t @@ -20,5 +20,5 @@ test:: $ test -f $FAKE_BINDIR/.fubar/0- $ test -x $FAKE_BINDIR/.fubar/0- $ cat $FAKE_BINDIR/.fubar/0- - #!/bin/sh + #!*/sh (glob) echo "hello world!" diff --git a/t/error-files.t b/t/error-files.t index 1b10418..7decae8 100644 --- a/t/error-files.t +++ b/t/error-files.t @@ -19,7 +19,7 @@ test:: $ test -f $FAKE_BINDIR/.fubar/0- $ test -x $FAKE_BINDIR/.fubar/0- $ cat $FAKE_BINDIR/.fubar/0- - #!/bin/sh + #!*/sh (glob) cat >&2 <<\EOF gloomy sunday... EOF diff --git a/t/exitcode-files.t b/t/exitcode-files.t index 287f54c..bd0b81d 100644 --- a/t/exitcode-files.t +++ b/t/exitcode-files.t @@ -17,5 +17,5 @@ test:: $ test -f $FAKE_BINDIR/.fubar/0- $ test -x $FAKE_BINDIR/.fubar/0- $ cat $FAKE_BINDIR/.fubar/0- - #!/bin/sh + #!*sh (glob) exit 42 diff --git a/t/output-files.t b/t/output-files.t index eb856a9..0c1be9c 100644 --- a/t/output-files.t +++ b/t/output-files.t @@ -19,7 +19,7 @@ test:: $ test -f $FAKE_BINDIR/.fubar/0- $ test -x $FAKE_BINDIR/.fubar/0- $ cat $FAKE_BINDIR/.fubar/0- - #!/bin/sh + #!*/sh (glob) cat >&1 <<\EOF hello world! EOF