libisoburn/releng/inc/releng_getopts.inc

56 lines
1.1 KiB
PHP
Raw Normal View History

SELF=$(basename $0)
RELENG_XORRISO=0
KEEP=0
SIMULATE_FAILURE=0
usage() {
cat << EOF
Usage: $SELF -x path/to/xorriso [-k0|1] [-f0|1] [-h]
-x absolute or relative path to binary to be run.
-k keep selfgenerated data, values 0,1 default 0.
-f simulate failure, values 0,1 default 0.
EOF
}
while getopts “x:k:f:h” OPTION
do
case $OPTION in
x)
RELENG_XORRISO=$OPTARG
;;
k)
KEEP=$OPTARG
;;
f)
SIMULATE_FAILURE=$OPTARG
;;
h)
usage
exit 0
;;
*)
usage
exit 31
;;
esac
done
if [ ! -x $RELENG_XORRISO ]; then
usage
printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n"
exit 31
fi
if [ x"$KEEP" != x"0" -a x"$KEEP" != x"1" ]; then
usage
printf "\n${SELF}: -k keep selfgenerated data, values 0,1 default 0.\n\n"
exit 31
fi
if [ x"$SIMULATE_FAILURE" != x"0" -a x"$SIMULATE_FAILURE" != x"1" ]; then
usage
printf "\n${SELF}: -f simulate failure, values 0,1 default 0.\n\n"
exit 31
fi