diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-05-18 09:08:19 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-05-18 09:08:19 -0300 |
commit | 2c731c0434583dc43e02b7c9db216e2e9e09fd7c (patch) | |
tree | 5058f8446605bf0e5b0077f762f5062dc3353389 | |
parent | 5bfc3832b1b5e6d1f610f436a5f5b52342635696 (diff) | |
download | inception-2c731c0434583dc43e02b7c9db216e2e9e09fd7c.tar.gz inception-2c731c0434583dc43e02b7c9db216e2e9e09fd7c.tar.bz2 |
Better action handling
-rwxr-xr-x | infection | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -8,6 +8,7 @@ BASENAME="`basename $0`" EXCLUDES="--exclude=local --exclude=stowpkg/tree" DATE="`date +%Y%m%d%I%M%S`" BACKUPS="$HOME/.backups/$DATE" +ACTION="$1" # Make sure we're running git directly and not any existing wrapper GIT="/usr/bin/git" @@ -46,9 +47,11 @@ function infection_init { cd $DIRNAME &> /dev/null - echo "Initializing submodules..." - $GIT submodule sync --recursive - $GIT submodule update --init --recursive + if [ "$ACTION" == "fetch" ] && [ "$ACTION" == "merge" ]; then + echo "Initializing submodules..." + $GIT submodule sync --recursive + $GIT submodule update --init --recursive + fi # Convert to new dotfiles layout # @@ -201,22 +204,22 @@ fi infection_init # Main -if [ "$1" == "load" ]; then +if [ "$ACTION" == "load" ]; then infection_load $* -#elif [ "$1" == "init" ]; then +#elif [ "$ACTION" == "init" ]; then # infection_init -elif [ "$1" == "install" ]; then +elif [ "$ACTION" == "install" ]; then infection_install $* -elif [ "$1" == "deploy" ]; then +elif [ "$ACTION" == "deploy" ]; then infection_deploy $* -elif [ "$1" == "version" ]; then +elif [ "$ACTION" == "version" ]; then infection_version -elif [ "$1" == "fetch" ]; then +elif [ "$ACTION" == "fetch" ]; then infection_fetch -elif [ "$1" == "merge" ]; then +elif [ "$ACTION" == "merge" ]; then infection_merge -elif [ "$1" == "status" ]; then +elif [ "$ACTION" == "status" ]; then infection_status -elif [ "$1" != "init" ]; then +elif [ "$ACTION" != "init" ]; then infection_usage fi |