Renamed controll variable $SIT_RUN_OPTION to more adequate $sit_action.

This commit is contained in:
Christoph Niethammer 2016-05-02 08:55:18 +00:00
parent 4dff164737
commit ad39567ef5

69
sit
View file

@ -10,18 +10,18 @@ set -e
# for debugging:
# set -x
# Reading in execution option
SIT_RUN_OPTION=$2
if [[ -n $SIT_RUN_OPTION ]] ; then
echo "Executing with option: $SIT_RUN_OPTION"
else
echo "Default execution"
fi
SIT_PATH=$(cd $(dirname $PWD/$0); pwd)
SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf
SIT_USER_CONFIG_FILE=$HOME/.sit
# sit action to be performed
sit_action=$2
if [[ -n $sit_action ]] ; then
echo "Performing action: $sit_action"
else
sit_action="all"
fi
# Reading in user configuration file if it exists
if [[ -e $SIT_USER_CONFIG_FILE ]] ; then
source $SIT_USER_CONFIG_FILE
@ -195,7 +195,7 @@ sit_countdown 3
# if working dir already exists and execution option is Default then remove
# previous working directory and create new
if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then
if [[ -d ${WORKDIR} && -z $sit_action ]] ; then
sit_info "Removing existing working directory ${WORKDIR}"
sit_countdown 5
rm -rf ${WORKDIR}
@ -214,56 +214,55 @@ else
fi
case $SIT_RUN_OPTION in
case $sit_action in
"sitinfo")
sit_sitinfo >> "$LOGDIR/sit_cmd.log"
sit_sitinfo >> "$LOGDIR/sit_cmd.log"
;;
"unpack")
sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} )
sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} )
;;
"prepare")
sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} )
sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} )
;;
"configure")
sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} )
sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} )
;;
"build")
sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} )
sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} )
;;
"pretest")
sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} )
sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} )
;;
"install")
sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} )
sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} )
;;
"posttest")
sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} )
sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} )
;;
"postinst")
sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} )
sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} )
;;
"copy_logs")
sit_copy_logs
sit_copy_logs
;;
"setperms")
sit_setperms
sit_setperms
;;
"")
sit_sitinfo >> "$LOGDIR/sit_cmd.log"
sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} )
sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} )
sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} )
sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} )
sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} )
sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} )
sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} )
sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} )
sit_copy_logs
sit_setperms
"all")
sit_sitinfo >> "$LOGDIR/sit_cmd.log"
sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} )
sit_prepare 2>&1 | tee "$LOGDIR/prepare.log"; ( exit ${PIPESTATUS[0]} )
sit_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} )
sit_build 2>&1 | tee "$LOGDIR/make.log"; ( exit ${PIPESTATUS[0]} )
sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} )
sit_install 2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} )
sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} )
sit_postinst 2>&1 | tee "$LOGDIR/postinst.log"; ( exit ${PIPESTATUS[0]} )
sit_copy_logs
sit_setperms
;;
*)
echo "Argument $SIT_RUN_OPTION unrecognized."
echo "Unknown action $sit_action"
esac