1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

scripts/makepkg.in: Switch to GNU getopt.

Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
This commit is contained in:
Andrew Fyfe 2007-06-05 11:58:25 +01:00
parent e2a75a8257
commit 54b71f0427

View File

@ -1010,98 +1010,62 @@ if [ -z "$SRCROOT" ]; then
SRCROOT=$ABSROOT SRCROOT=$ABSROOT
fi fi
while [ "$#" -ne "0" ]; do
case $1 in
# pacman # Parse Command Line Options.
OPT_SHORT="bcCdefghiLmop:rRsSV"
OPT_LONG="asroot,builddeps,clean,cleancache,nodeps,noextract,force,geninteg,help,install,log"
OPT_LONG="$OPT_LONG,nocolor,nobuild,rmdeps,repackage,source,syncdeps,usesudo,version"
# Pacman Options
OPT_LONG="$OPT_LONG,noconfirm,noprogressbar"
OPT_TEMP="$(getopt -o "$OPT_SHORT" -l "$OPT_LONG" -n "$(basename "$0")" -- "$@" || echo 'GETOPT GO BANG!')"
if echo "$OPT_TEMP" | grep -q 'GETOPT GO BANG!'; then
# This is a small hack to stop the script bailing with 'set -e'
echo; usage; exit 1 # E_INVALID_OPTION;
fi
eval set -- "$OPT_TEMP"
unset OPT_SHORT OPT_LONG OPT_TEMP
while true; do
case "$1" in
# Pacman Options
--noconfirm) PACMAN_OPTS="$PACMAN_OPTS --noconfirm" ;; --noconfirm) PACMAN_OPTS="$PACMAN_OPTS --noconfirm" ;;
--noprogressbar) PACMAN_OPTS="$PACMAN_OPTS --noprogressbar" ;; --noprogressbar) PACMAN_OPTS="$PACMAN_OPTS --noprogressbar" ;;
# makepkg
# Makepkg Options
--asroot) ASROOT=1 ;; --asroot) ASROOT=1 ;;
--clean) CLEANUP=1 ;; -A|--ignorearch) IGNOREARCH=1 ;;
--cleancache) CLEANCACHE=1 ;; -b|--builddeps) DEP_SRC=1 ;;
--syncdeps) DEP_BIN=1 ;; -c|--clean) CLEANUP=1 ;;
--builddeps) DEP_SRC=1 ;; -C|--cleancache) CLEANCACHE=1 ;;
--nodeps) NODEPS=1 ;; -d|--nodeps) NODEPS=1 ;;
--noextract) NOEXTRACT=1 ;; -e|--noextract) NOEXTRACT=1 ;;
--ignorearch) IGNOREARCH=1 ;; -f|--force) FORCE=1 ;;
--install) INSTALL=1 ;; -g|--geninteg) GENINTEG=1 ;;
--force) FORCE=1 ;; -i|--install) INSTALL=1 ;;
--nobuild) NOBUILD=1 ;; -L|--log) LOGGING=1 ;;
--nocolor) USE_COLOR="n" ;; -m|--nocolor) USE_COLOR='n' ;;
--geninteg) GENINTEG=1 ;; -o|--nobuild) NOBUILD=1 ;;
--rmdeps) RMDEPS=1 ;; -r|--rmdeps) RMDEPS=1 ;;
--repackage) REPKG=1 ;; -R|--repackage) REPKG=1 ;;
--log) LOGGING=1 ;;
--source) SOURCEONLY=1 ;; --source) SOURCEONLY=1 ;;
-s|--syncdeps) DEP_BIN=1 ;;
# BEGIN DEPRECATED # BEGIN DEPRECATED
--usesudo) -S|--usesudo)
warning "$(gettext "Sudo is used by default now. The --usesudo option is deprecated!")" ;; warning "$(gettext "Sudo is used by default now. The --usesudo option is deprecated!")" ;;
# END DEPRECATED # END DEPRECATED
--help) -h|--help) usage; exit 0 ;; # E_OK
usage -V|--version) version; exit 0 ;; # E_OK
exit 0 #E_OK
;;
--version)
version
exit 0 #E_OK
;;
--*)
usage
exit 1 #E_INVALID_OPTION
;;
-*)
while getopts "AbcCdefFghiLmop:rRsSV-" opt; do
case $opt in
A) IGNOREARCH=1 ;;
b) DEP_SRC=1 ;;
c) CLEANUP=1 ;;
C) CLEANCACHE=1 ;;
d) NODEPS=1 ;;
e) NOEXTRACT=1 ;;
f) FORCE=1 ;;
F) INFAKEROOT=1 ;;
g) GENINTEG=1 ;;
i) INSTALL=1 ;;
L) LOGGING=1 ;;
m) USE_COLOR="n" ;;
o) NOBUILD=1 ;;
p) BUILDSCRIPT=$OPTARG ;;
r) RMDEPS=1 ;;
R) REPKG=1 ;;
s) DEP_BIN=1 ;;
# BEGIN DEPRECATED --) OPT_IND=0; shift; break;
S) *) usage; exit 1 ;; # E_INVALID_OPTION
warning "$(gettext "Sudo is used by default now. The --usesudo option is deprecated!")" ;;
# END DEPRECATED
h)
usage
exit 0 #E_OK
;;
V)
version
exit 0 #E_OK
;;
-)
OPTIND=0
break
;;
*)
usage
exit 1 #E_INVALID_OPTION
;;
esac
done
;;
*)
true
;;
esac esac
shift shift
done done
if [ "$CLEANCACHE" = "1" ]; then if [ "$CLEANCACHE" = "1" ]; then
#fix flyspray feature request #5223 #fix flyspray feature request #5223
if [ -n "$SRCDEST" -a "$SRCDEST" != "$startdir" ]; then if [ -n "$SRCDEST" -a "$SRCDEST" != "$startdir" ]; then