Preparing scripts for the "clean" target

This commit is contained in:
Pierre Pronchery 2013-01-07 02:42:50 +01:00
parent 6b7e8dbdd8
commit 9aa3aabc4c

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
#$Id$ #$Id$
#Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> #Copyright (c) 2012-2013 Pierre Pronchery <khorben@defora.org>
#This program is free software: you can redistribute it and/or modify #This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by #it under the terms of the GNU General Public License as published by
#the Free Software Foundation, version 3 of the License. #the Free Software Foundation, version 3 of the License.
@ -39,16 +39,20 @@ _debug()
#usage #usage
_usage() _usage()
{ {
echo "Usage: subst.sh [-i|-u][-P prefix] target" 1>&2 echo "Usage: subst.sh [-c|-i|-u][-P prefix] target..." 1>&2
return 1 return 1
} }
#main #main
clean=0
install=0 install=0
uninstall=0 uninstall=0
while getopts iuP: name; do while getopts "ciuP:" name; do
case $name in case $name in
c)
clean=1
;;
i) i)
uninstall=0 uninstall=0
install=1 install=1
@ -76,6 +80,9 @@ while [ $# -gt 0 ]; do
target="$1" target="$1"
shift shift
#clean
[ "$clean" -ne 0 ] && continue
#uninstall #uninstall
if [ "$uninstall" -eq 1 ]; then if [ "$uninstall" -eq 1 ]; then
$DEBUG $RM -- "$PREFIX/$target" || exit 2 $DEBUG $RM -- "$PREFIX/$target" || exit 2