From aa0fae61a2f6e2fc501dfd3fe5e041f41bdca60d Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 25 Dec 2017 23:07:38 -0200 Subject: Manage dotfiles inside this repo --- .gitmodules | 3 +++ README.md | 2 +- dotfiles | 1 + inception | 57 ++++++++++++++++++++++++++++++++++++++++----------------- 4 files changed, 45 insertions(+), 18 deletions(-) create mode 160000 dotfiles diff --git a/.gitmodules b/.gitmodules index 6c993cb..bfd9e83 100644 --- a/.gitmodules +++ b/.gitmodules @@ -112,3 +112,6 @@ [submodule "qutebrowser"] path = qutebrowser url = https://git.fluxo.info/qutebrowser +[submodule "dotfiles"] + path = dotfiles + url = https://git.fluxo.info/rhatto/dotfiles diff --git a/README.md b/README.md index 0876618..4c48b65 100644 --- 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 index 0000000..ee38ade --- /dev/null +++ b/dotfiles @@ -0,0 +1 @@ +Subproject commit ee38adeb97bce2db61b5a9d09c5c90088522c31d diff --git a/inception b/inception index 6bd7127..3bb9d78 100755 --- 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 <