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 " setperms"
echo " all"
exit 0
}
# sit class file to be installed
sit_classfile=$1
sit_classfile=""
# sit action to be performed
sit_action=$2
if [[ -n $sit_action ]] ; then
echo "Performing action: $sit_action"
else
sit_action="all"
fi
sit_action="all"
while [ $1 != "" ] ; do
case $1 in
"sitinfo")
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
if [[ -e $SIT_USER_CONFIG_FILE ]] ; then