applets/install: accept more than one install option

Currently, it is impossible to pass more than one option to the isntall
script, so it totally prevents using --noclobber.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Yann E. MORIN 2017-12-28 23:49:48 +01:00 committed by Denys Vlasenko
parent 84be5ce0d8
commit 952d5a6024

View File

@ -8,6 +8,7 @@ if [ -z "$prefix" ]; then
echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks/--binaries/--scriptwrapper]" echo "usage: applets/install.sh DESTINATION [--symlinks/--hardlinks/--binaries/--scriptwrapper]"
exit 1 exit 1
fi fi
shift # Keep only remaining options
# Source the configuration # Source the configuration
. ./.config . ./.config
@ -21,18 +22,21 @@ scriptwrapper="n"
binaries="n" binaries="n"
cleanup="0" cleanup="0"
noclobber="0" noclobber="0"
case "$2" in while [ ${#} -gt 0 ]; do
--hardlinks) linkopts="-f";; case "$1" in
--symlinks) linkopts="-fs";; --hardlinks) linkopts="-f";;
--binaries) binaries="y";; --symlinks) linkopts="-fs";;
--scriptwrapper) scriptwrapper="y";swrapall="y";; --binaries) binaries="y";;
--sw-sh-hard) scriptwrapper="y";linkopts="-f";; --scriptwrapper) scriptwrapper="y"; swrapall="y";;
--sw-sh-sym) scriptwrapper="y";linkopts="-fs";; --sw-sh-hard) scriptwrapper="y"; linkopts="-f";;
--cleanup) cleanup="1";; --sw-sh-sym) scriptwrapper="y"; linkopts="-fs";;
--noclobber) noclobber="1";; --cleanup) cleanup="1";;
"") h="";; --noclobber) noclobber="1";;
*) echo "Unknown install option: $2"; exit 1;; "") h="";;
esac *) echo "Unknown install option: $1"; exit 1;;
esac
shift
done
if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then if [ -n "$DO_INSTALL_LIBS" ] && [ "$DO_INSTALL_LIBS" != "n" ]; then
# get the target dir for the libs # get the target dir for the libs