--- a/lib/scripts/patch-scripts.bash Mon Jul 12 10:32:30 1999 +0200
+++ b/lib/scripts/patch-scripts.bash Mon Jul 12 10:38:31 1999 +0200
@@ -1,27 +1,23 @@
#
# $Id$
#
-# patch-scripts.bash - relocate interpreter paths of executable scripts.
+# patch-scripts.bash - relocate interpreter paths of executable scripts and
+# insert AUTO_BASH/AUTO_PERL values
#
## find binaries
function findbin()
{
- local DEFAULT="$1"
- local BASE=$(basename "$DEFAULT")
+ local BASE="$1"
local BINARY=""
BINARY=$(type -path "$BASE")
if [ -n "$BINARY" ]; then
- echo "using $BINARY" >&2
+ echo "found $BINARY" >&2
echo "$BINARY"
return
- elif [ -f "$DEFAULT" ]; then
- echo "using $DEFAULT" >&2
- echo "$DEFAULT"
- return
else
echo "ERROR: $BASE not found!" >&2
echo "$DEFAULT"
@@ -32,15 +28,17 @@
## main
-BASH=$(findbin /bin/bash)
-PERL=$(findbin /usr/bin/perl)
+[ -z "$BASH_PATH" ] && BASH_PATH=$(findbin bash)
+[ -z "$PERL_PATH" ] && PERL_PATH=$(findbin perl)
+[ -z "$AUTO_BASH" ] && AUTO_BASH="$BASH_PATH"
+[ -z "$AUTO_PERL" ] && AUTO_PERL="$PERL_PATH"
for FILE in $(find . -type f -print)
do
if [ -x "$FILE" ]; then
- sed -e "s:^#!.*/bash:#!$BASH:" -e "s:^#!.*/perl:#!$PERL:" \
- -e "s:^AUTO_BASH=.*bash:AUTO_BASH=$BASH:" \
- -e "s:^AUTO_PERL=.*perl:AUTO_PERL=$PERL:" $FILE >$FILE~~
+ sed -e "s:^#!.*/bash:#!$BASH_PATH:" -e "s:^#!.*/perl:#!$PERL_PATH:" \
+ -e "s:^AUTO_BASH=.*bash:AUTO_BASH=$AUTO_BASH:" \
+ -e "s:^AUTO_PERL=.*perl:AUTO_PERL=$AUTO_PERL:" $FILE >$FILE~~
if cmp -s $FILE $FILE~~; then
rm $FILE~~
else