aboutsummaryrefslogtreecommitdiff
path: root/inception
blob: 184b983a66c904cb0cd42b6e05fed25fe7714fb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
#
# The inception.
#

# Parameters
BASENAME="`basename $0`"
DIRNAME="$(cd `dirname $0` &> /dev/null && pwd)"

# Main
if [ -z "$1" ] || [ "$1" == "init" ]; then
  (
    cd $DIRNAME

    echo "Initializing submodules..."
    git submodule update --init

    if [ ! -e "$HOME/.dotfiles" ]; then
      echo "Cloning default dotfiles..."
      ./metadot/metadot clone default
    fi

    echo "Checking latest tag..."
    cd $HOME/.dotfiles
    $DIRNAME/utils-git/git-check-tag

    echo "Checking out the latest tag..."
    $DIRNAME/utils-git/git-checkout-tag

    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."
elif [ "$1" == "load" ]; then
  (
    cd $DIRNAME

    echo "Loading all dotfiles..."
    ./metadot/metadot load --all
  )

  echo "Done. Logout and login again to apply all changes."
fi