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

25
sit
View file

@ -10,18 +10,18 @@ set -e
# for debugging: # for debugging:
# set -x # 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_PATH=$(cd $(dirname $PWD/$0); pwd)
SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf
SIT_USER_CONFIG_FILE=$HOME/.sit 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 # Reading in user configuration file if it exists
if [[ -e $SIT_USER_CONFIG_FILE ]] ; then if [[ -e $SIT_USER_CONFIG_FILE ]] ; then
source $SIT_USER_CONFIG_FILE source $SIT_USER_CONFIG_FILE
@ -195,7 +195,7 @@ sit_countdown 3
# if working dir already exists and execution option is Default then remove # if working dir already exists and execution option is Default then remove
# previous working directory and create new # 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_info "Removing existing working directory ${WORKDIR}"
sit_countdown 5 sit_countdown 5
rm -rf ${WORKDIR} rm -rf ${WORKDIR}
@ -214,7 +214,7 @@ else
fi fi
case $SIT_RUN_OPTION in case $sit_action in
"sitinfo") "sitinfo")
sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_sitinfo >> "$LOGDIR/sit_cmd.log"
;; ;;
@ -248,13 +248,12 @@ sit_copy_logs
"setperms") "setperms")
sit_setperms sit_setperms
;; ;;
"") "all")
sit_sitinfo >> "$LOGDIR/sit_cmd.log" sit_sitinfo >> "$LOGDIR/sit_cmd.log"
sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} ) sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"; ( exit ${PIPESTATUS[0]} )
sit_prepare 2>&1 | tee "$LOGDIR/prepare.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_configure 2>&1 | tee "$LOGDIR/configure.log"; ( exit ${PIPESTATUS[0]} )
sit_build 2>&1 | tee "$LOGDIR/make.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_pretest 2>&1 | tee "$LOGDIR/pretest.log"; ( exit ${PIPESTATUS[0]} )
sit_install 2>&1 | tee "$LOGDIR/make_install.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_posttest 2>&1 | tee "$LOGDIR/posttest.log"; ( exit ${PIPESTATUS[0]} )
@ -263,7 +262,7 @@ sit_copy_logs
sit_setperms sit_setperms
;; ;;
*) *)
echo "Argument $SIT_RUN_OPTION unrecognized." echo "Unknown action $sit_action"
esac esac