aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-05-18 09:08:19 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-05-18 09:08:19 -0300
commit2c731c0434583dc43e02b7c9db216e2e9e09fd7c (patch)
tree5058f8446605bf0e5b0077f762f5062dc3353389
parent5bfc3832b1b5e6d1f610f436a5f5b52342635696 (diff)
downloadinception-2c731c0434583dc43e02b7c9db216e2e9e09fd7c.tar.gz
inception-2c731c0434583dc43e02b7c9db216e2e9e09fd7c.tar.bz2
Better action handling
-rwxr-xr-xinfection27
1 files changed, 15 insertions, 12 deletions
diff --git a/infection b/infection
index 8572a6d..def25ca 100755
--- a/infection
+++ b/infection
@@ -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