'/bin/bash' is hardcoded in shebangs. bash is not a system shell in
 all platforms and its path is not necessarily '/bin/bash'.

 I used 'which bash' to detect the real path of bash.

Signed-off-by: Nezmer <[email protected]>
---
 contrib/Makefile.am           |    3 +++
 contrib/bacman                |    2 +-
 contrib/pacdiff               |    2 +-
 contrib/pacscripts            |    2 +-
 contrib/pactree               |    2 +-
 contrib/wget-xdelta.sh        |    2 +-
 scripts/Makefile.am           |    3 +++
 scripts/makepkg.sh.in         |    2 +-
 scripts/pacman-optimize.sh.in |    2 +-
 scripts/pkgdelta.sh.in        |    2 +-
 scripts/rankmirrors.sh.in     |    2 +-
 scripts/repo-add.sh.in        |    2 +-
 12 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 337a3f3..4c3b6a6 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -12,8 +12,11 @@ EXTRA_DIST = \
        zsh_completion \
        README
 
+BASH := $(shell sh -c 'which bash|| echo /bin/bash')
+
 edit = sed \
        -e 's|@localstated...@]|$(localstatedir)|g' \
+       -e 's|@ba...@]|$(BASH)|g' \
        -e 's|@sysconfd...@]|$(sysconfdir)|g'
 
 # Use sysconfdir
diff --git a/contrib/bacman b/contrib/bacman
index 504ba51..2a93f8b 100755
--- a/contrib/bacman
+++ b/contrib/bacman
@@ -1,4 +1,4 @@
-#!/bin/bash
+...@bash@
 #
 #   bacman: recreate a package from a running system
 #   This script rebuilds an already installed package using metadata
diff --git a/contrib/pacdiff b/contrib/pacdiff
index 3f26f38..716333a 100755
--- a/contrib/pacdiff
+++ b/contrib/pacdiff
@@ -1,4 +1,4 @@
-#!/bin/bash
+...@bash@
 #   pacdiff : a simple pacnew/pacorig/pacsave updater
 #
 #   Copyright (c) 2007 Aaron Griffin <[email protected]>
diff --git a/contrib/pacscripts b/contrib/pacscripts
index 3479dc1..123c79d 100755
--- a/contrib/pacscripts
+++ b/contrib/pacscripts
@@ -1,4 +1,4 @@
-#!/bin/bash
+...@bash@
 #
 #   pacscripts : tries to print out the {pre,post}_{install,remove,upgrade}
 #   scripts of a given package
diff --git a/contrib/pactree b/contrib/pactree
index 8a59a34..29c6af6 100755
--- a/contrib/pactree
+++ b/contrib/pactree
@@ -1,4 +1,4 @@
-#!/bin/bash
+...@bash@
 # pactree : a simple dependency tree viewer
 #
 # Copyright (C) 2008 Carlo "carlocci" Bersani <[email protected]>
diff --git a/contrib/wget-xdelta.sh b/contrib/wget-xdelta.sh
index a77b2b3..caf0171 100755
--- a/contrib/wget-xdelta.sh
+++ b/contrib/wget-xdelta.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+...@bash@
 
 if [ -r "@sysconfdir@/makepkg.conf" ]; then
        source @sysconfdir@/makepkg.conf
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 31e8fb5..5967ab1 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -29,12 +29,15 @@ else
 REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
 endif
 
+BASH := $(shell sh -c 'which bash|| echo /bin/bash')
+
 #### Taken from the autoconf scripts Makefile.am ####
 edit = sed \
        -e 's|@localed...@]|$(localedir)|g' \
        -e 's|@sysconfd...@]|$(sysconfdir)|g' \
        -e 's|@localstated...@]|$(localstatedir)|g' \
        -e 's|@pref...@]|$(prefix)|g' \
+       -e 's|@ba...@]|$(BASH)|g' \
        -e 's|@package_versi...@]|$(REAL_PACKAGE_VERSION)|g' \
        -e 's|@package_bugrepo...@]|$(PACKAGE_BUGREPORT)|g' \
        -e 's|@package_na...@]|$(PACKAGE_NAME)|g' \
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 3a7a4d1..baabf26 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+...@bash@ -e
 #
 #   makepkg - make packages compatible for use with pacman
 #   @configure_input@
diff --git a/scripts/pacman-optimize.sh.in b/scripts/pacman-optimize.sh.in
index 78b2345..eb6691c 100644
--- a/scripts/pacman-optimize.sh.in
+++ b/scripts/pacman-optimize.sh.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+...@bash@
 #
 #   pacman-optimize
 #   @configure_input@
diff --git a/scripts/pkgdelta.sh.in b/scripts/pkgdelta.sh.in
index 1550fa1..d45678d 100644
--- a/scripts/pkgdelta.sh.in
+++ b/scripts/pkgdelta.sh.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+...@bash@
 #
 #   pkgdelta - create delta files for use with pacman and repo-add
 #   @configure_input@
diff --git a/scripts/rankmirrors.sh.in b/scripts/rankmirrors.sh.in
index a0ff6d5..3851b77 100644
--- a/scripts/rankmirrors.sh.in
+++ b/scripts/rankmirrors.sh.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+...@bash@
 #
 #   rankmirrors - read a list of mirrors from a file and rank them by speed
 #   @configure_input@
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 8ef940d..4338011 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+...@bash@
 #
 #   repo-add - add a package to a given repo database file
 #   repo-remove - remove a package entry from a given repo database file
-- 
1.7.3.1


Reply via email to