diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | README.md | 2 | ||||
m--------- | dotfiles | 0 | ||||
-rwxr-xr-x | inception | 57 |
4 files changed, 44 insertions, 18 deletions
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 @@ -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 +Subproject ee38adeb97bce2db61b5a9d09c5c90088522c31 @@ -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 |