From ad39567ef51519acc6696cfccefd0a8ed7804b9e Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Mon, 2 May 2016 08:55:18 +0000 Subject: [PATCH] Renamed controll variable $SIT_RUN_OPTION to more adequate $sit_action. --- sit | 69 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/sit b/sit index 0cc7dda..0c21415 100755 --- a/sit +++ b/sit @@ -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