Command line option parsing at the begin of sit.
This commit is contained in:
parent
a3e4b5af54
commit
e24d4ed21b
1 changed files with 34 additions and 8 deletions
40
sit
40
sit
|
@ -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
|
|
||||||
if [[ -n $sit_action ]] ; then
|
|
||||||
echo "Performing action: $sit_action"
|
|
||||||
else
|
|
||||||
sit_action="all"
|
sit_action="all"
|
||||||
fi
|
|
||||||
|
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
|
# Reading in user configuration file if it exists
|
||||||
if [[ -e $SIT_USER_CONFIG_FILE ]] ; then
|
if [[ -e $SIT_USER_CONFIG_FILE ]] ; then
|
||||||
|
|
Loading…
Reference in a new issue