Command line option parsing at the begin of sit.

This commit is contained in:
Christoph Niethammer 2016-05-02 09:35:39 +00:00
parent a3e4b5af54
commit e24d4ed21b

42
sit
View file

@ -29,18 +29,44 @@ function usage() {
echo " copy_logs" echo " copy_logs"
echo " setperms" echo " setperms"
echo " all" echo " all"
exit 0
} }
# sit class file to be installed # sit class file to be installed
sit_classfile=$1 sit_classfile=""
# sit action to be performed # sit action to be performed
sit_action=$2 sit_action="all"
if [[ -n $sit_action ]] ; then
echo "Performing action: $sit_action" while [ $1 != "" ] ; do
else case $1 in
sit_action="all" "sitinfo")
fi sit_sitinfo
exit 0
;;
"all"| \
"unpack"| \
"prepare"| \
"configure"| \
"build"| \
"pretest"| \
"install"| \
"posttest"| \
"postinst"| \
"copy_logs"| \
"setperms")
sit_action=$1
;;
"-*h"|"--help"|"help"|"usage")
usage $@
exit 0
;;
*)
sit_classfile=$1
;;
esac
shift
done
echo "Actions to perform: $sit_action"
echo "Sit class file(s): $sit_classfile"
# Reading in user configuration file if it exists # Reading in user configuration file if it exists
if [[ -e $SIT_USER_CONFIG_FILE ]] ; then if [[ -e $SIT_USER_CONFIG_FILE ]] ; then