Import newer version of the script upstream

This commit is contained in:
Pierre Pronchery 2017-10-16 00:52:44 +02:00
parent 7dbe835565
commit 99293091c1

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
#$Id$ #$Id$
#Copyright (c) 2012-2014 Pierre Pronchery <khorben@defora.org> #Copyright (c) 2012-2017 Pierre Pronchery <khorben@defora.org>
# #
#Redistribution and use in source and binary forms, with or without #Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met: #modification, are permitted provided that the following conditions are met:
@ -42,7 +42,7 @@ XSLTPROC="xsltproc --nonet --xinclude"
#debug #debug
_debug() _debug()
{ {
echo "$@" 1>&2 echo "$@" 1>&3
"$@" "$@"
} }
@ -114,7 +114,7 @@ _usage()
clean=0 clean=0
install=0 install=0
uninstall=0 uninstall=0
while getopts "ciuP:" name; do while getopts "ciO:uP:" name; do
case "$name" in case "$name" in
c) c)
clean=1 clean=1
@ -123,6 +123,9 @@ while getopts "ciuP:" name; do
uninstall=0 uninstall=0
install=1 install=1
;; ;;
O)
export "${OPTARG%%=*}"="${OPTARG#*=}"
;;
u) u)
install=0 install=0
uninstall=1 uninstall=1
@ -137,7 +140,7 @@ while getopts "ciuP:" name; do
esac esac
done done
shift $((OPTIND - 1)) shift $((OPTIND - 1))
if [ $# -eq 0 ]; then if [ $# -lt 1 ]; then
_usage _usage
exit $? exit $?
fi fi
@ -151,6 +154,7 @@ fi
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share" [ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man" [ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
exec 3>&1
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
target="$1" target="$1"
shift shift
@ -194,7 +198,11 @@ while [ $# -gt 0 ]; do
#install #install
if [ "$install" -eq 1 ]; then if [ "$install" -eq 1 ]; then
source="${target#$OBJDIR}" source="${target#$OBJDIR}"
$DEBUG $MKDIR -- "$instdir" || exit 2 dirname=
if [ "${source%/*}" != "$source" ]; then
dirname="/${source%/*}"
fi
$DEBUG $MKDIR -- "$instdir$dirname" || exit 2
$DEBUG $INSTALL "$target" "$instdir/$source" || exit 2 $DEBUG $INSTALL "$target" "$instdir/$source" || exit 2
continue continue
fi fi