]> gitweb.fluxo.info Git - inception.git/commitdiff
Better action handling
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 18 May 2018 12:08:19 +0000 (09:08 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 18 May 2018 12:08:19 +0000 (09:08 -0300)
infection

index 8572a6d58d7443603535ec1e009cd17a300f6bbf..def25ca69e55e628f0276e6476ad2e40993337eb 100755 (executable)
--- 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