aboutsummaryrefslogtreecommitdiff
path: root/inception
diff options
context:
space:
mode:
Diffstat (limited to 'inception')
-rwxr-xr-xinception57
1 files changed, 40 insertions, 17 deletions
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 <<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