easy-build.sh: use getopts instead of rolling our own option parsing
Patch from Ian Campbell.
This commit is contained in:
parent
bee30ee646
commit
204ab4e96f
|
@ -6,7 +6,10 @@ set -e
|
||||||
## See also CONF.sh for the meaning of variables used here.
|
## See also CONF.sh for the meaning of variables used here.
|
||||||
|
|
||||||
show_usage() {
|
show_usage() {
|
||||||
echo "Usage: $(basename $0) [-d gnome|kde|lxde|xfce|light|all] BC|NETINST|CD|DVD [<ARCH> ...]"
|
echo "Usage: $(basename $0) [OPTIONS] BC|NETINST|CD|DVD [<ARCH> ...]"
|
||||||
|
echo " Options:"
|
||||||
|
echo " -d gnome|kde|lxde|xfce|light|all : desktop variant (task) to use"
|
||||||
|
echo " -h : help"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,19 +28,30 @@ if [ $# -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
desktop=
|
desktop=
|
||||||
if [ "$1" = "-d" ]; then
|
while getopts d:h OPT; do
|
||||||
case $2 in
|
case $OPT in
|
||||||
# Note: "gnome" is the special gnome task, not the generic task
|
d)
|
||||||
gnome|kde|lxde|xfce|light|all)
|
case $OPTARG in
|
||||||
desktop=$2
|
# Note: "gnome" is the special gnome task, not the generic task
|
||||||
shift 2
|
gnome|kde|lxde|xfce|light|all)
|
||||||
|
desktop=$2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
show_usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac ;;
|
||||||
|
h)
|
||||||
|
show_usage
|
||||||
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
\?)
|
||||||
show_usage
|
show_usage
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
done
|
||||||
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
export DISKTYPE="$1"
|
export DISKTYPE="$1"
|
||||||
shift
|
shift
|
||||||
|
|
Loading…
Reference in New Issue