Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.5.4
-
None
-
None
-
linux 2.6.29.2 (bluewhite64)
Description
The current initialization script under /etc/init.d does not take into consideration when it's run from that directory using the "./" prefix.
Currently, at least in version 1.5.4, starting on line 70, you have...
case $0 in
/*)
SCRIPT="$0"
;;
*)
PWD=`pwd`
SCRIPT="$PWD/$0"
;;
esac
, which assumes the script is started with its fully qualified name or as a single word, assuming you have `pwd` on your path.
One possible solution is to have these lines replaced by the following...
case $0 in
/*)
SCRIPT="$0"
;;
./*)
SCRIPT="`pwd`/`echo $0 | sed -e 's/^[ ]*\.\///'`"
;;
*)
SCRIPT="`pwd`/`echo $0 | sed -e 's/^[ ]*//'`"
;;
esac
The PWD variable is not used anywhere else in the script, thus it's not really necessary. But more importantly, it now can work with the "./" prefix, and also clears spaces at the beginning of the line, if any.
The following lines make up the patch file...
74,76c74,78
< *)
< PWD=`pwd`
< SCRIPT="$PWD/$0"
—
> ./*)
> SCRIPT="`pwd`/`echo $0 | sed -e 's/^[ ]*\.\///'`"
> ;;
> *)
> SCRIPT="`pwd`/`echo $0 | sed -e 's/^[ ]*//'`"
78a81
> echo $SCRIPT
Cheers, Alex Alvarez