]> gitweb.fluxo.info Git - rhatto/apps.git/commitdiff
Manage dotfiles inside this repo
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 26 Dec 2017 01:07:38 +0000 (23:07 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 26 Dec 2017 01:07:38 +0000 (23:07 -0200)
.gitmodules
README.md
dotfiles [new submodule]
inception

index 6c993cb15dc29a205b2e165f2af4bd0ad08ad3d0..bfd9e83a9e24e9b9bc176efa0cde904efb05f1e8 100644 (file)
 [submodule "qutebrowser"]
        path = qutebrowser
        url = https://git.fluxo.info/qutebrowser
+[submodule "dotfiles"]
+       path = dotfiles
+       url = https://git.fluxo.info/rhatto/dotfiles
index 08766185d979c7210a84d4acf3183718d0bd425c..4c48b65f0f79e9f72fbe095bb1f42752baaa1281 100644 (file)
--- a/README.md
+++ b/README.md
@@ -95,7 +95,7 @@ This repository also plays well with the following `$HOME` folder structure:
     mail: maildir
     temp: temporary folder
 
-Note the all folder names have:
+Note that all folder names have:
 
 * The same lenght so I get free alignment on lists.
 * Lowercase characters to save typing.
diff --git a/dotfiles b/dotfiles
new file mode 160000 (submodule)
index 0000000..ee38ade
--- /dev/null
+++ b/dotfiles
@@ -0,0 +1 @@
+Subproject commit ee38adeb97bce2db61b5a9d09c5c90088522c31d
index 6bd712784c2fbd4d3799c5fa2076539f05985da0..3bb9d782a23ec134d5aa3a572cc321844c95000c 100755 (executable)
--- a/inception
+++ b/inception
@@ -7,6 +7,8 @@
 BASENAME="`basename $0`"
 DIRNAME="$(cd `dirname $0` &> /dev/null && pwd)"
 EXCLUDES="--exclude=local --exclude=stowpkg/tree"
+DATE="`date +%Y%m%d%I%M%S`"
+BACKUPS="$HOME/.backups/$DATE"
 
 # Make sure we're running git directly and not any existing wrapper
 GIT="/usr/bin/git"
@@ -26,14 +28,25 @@ function inception_init {
     $GIT submodule sync          --recursive
     $GIT submodule update --init --recursive
 
-    if [ ! -e "$HOME/.dotfiles" ]; then
-      echo "Cloning default dotfiles..."
-      ./metadot/metadot clone default
-    else
-      echo "Updating dotfiles..."
-      ./metadot/metadot fetch
+    # Convert to new dotfiles layout
+    #
+    # This way we can easily check the integrity of our dotfiles
+    # once the integrity of the apps repo is checked
+    if [ -e "$HOME/.dotfiles" ]; then
+       if [ ! -h "$HOME/.dotfiles" ] || [ "`readlink $HOME/.dotfiles`" != "apps/dotfiles" ]; then
+        mv $HOME/.dotfiles $BACKUPS/
+        ( cd $HOME && ln -s $HOME/apps/dotfiles .dotfiles )
+      fi
     fi
 
+    #if [ ! -e "$HOME/.dotfiles" ]; then
+    #  echo "Cloning default dotfiles..."
+    #  ./metadot/metadot clone default
+    #else
+    #  echo "Updating dotfiles..."
+    #  ./metadot/metadot fetch
+    #fi
+
     #echo "Checking latest tag..."
     #cd $HOME/.dotfiles
     #$DIRNAME/utils-git/git-check-tag
@@ -41,13 +54,15 @@ function inception_init {
     #echo "Checking out the latest tag..."
     #$DIRNAME/utils-git/git-checkout-tag
 
-    echo "Checking dotfiles..."
-    $DIRNAME/metadot/metadot version
+    #echo "Checking dotfiles..."
+    #$DIRNAME/metadot/metadot version
   )
 
-  echo ""
-  echo "Please manually verify dotfiles version and tag from the above output."
-  echo "If everything is fine, proceed running this command again with the 'load' parameter."
+  #echo ""
+  #echo "Please manually verify dotfiles version and tag from the above output."
+  #echo "If everything is fine, proceed running this command again with the 'load' parameter."
+
+  cd -
 }
 
 # Load
@@ -65,7 +80,7 @@ function inception_load {
       if [ "$DEPENDENCIES" == "--deps" ]; then
         ./metadot/metadot deps --all
       fi
-    elif [ -z "$BUNDLE" ]; then
+    elif [ -z "$BUNDLE" ]; then
       echo "Loading $BUNDLE dotfiles..."
       ./metadot/metadot load-bundle $BUNDLE
 
@@ -80,7 +95,7 @@ function inception_load {
 
 # Install
 function inception_install {
-  $0 init
+  #$0 init
   $0 load $*
 }
 
@@ -106,6 +121,7 @@ function inception_deploy {
       # Sync loaded modules
       ssh -T $REMOTE <<EOF
       ##### BEGIN REMOTE SCRIPT #####
+      \$HOME/apps/inception load
       for module in $MODULES; do
         \$HOME/apps/metadot/metadot load \$module
       done
@@ -148,13 +164,20 @@ function inception_status {
   ( cd $DIRNAME && git status --ignored && git submodule foreach --recursive git status --ignored )
 }
 
-# Main
+# Check
 if [ -z "$1" ]; then
   inception_usage
-elif [ "$1" == "init" ]; then
-  inception_init
-elif [ "$1" == "load" ]; then
+  exit 1
+fi
+
+# Initialize
+inception_init
+
+# Main
+if [ "$1" == "load" ]; then
   inception_load $*
+#elif [ "$1" == "init" ]; then
+#  inception_init
 elif [ "$1" == "install" ]; then
   inception_install $*
 elif [ "$1" == "deploy" ]; then