summaryrefslogtreecommitdiff
path: root/bin/bstraph.sh
blob: 4983b710d6dea6919a723e23e0e6ddd59e7f7d8f (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
#!/bin/sh

. $HOME/src/dotfiles/.shenv

# Bootstrap home directory after dotfiles repository successfully
# cloned (see ~/bin/insinuate-dotfiles).  This script should
# definitely be POSIX sh

set -e

# ---- Perform the bootstrap

$HOME/src/dotfiles/bin/normalise-mrconfig
(
    cd $HOME/src/dotfiles
    mr fixups
    mr stow

    if [ -z $(git remote) ]; then
        # don't set up any tracking branches or fetch it
        git remote add origin athena:dotfiles
    fi
)

echo "I: dotfiles bootstrap successful"

# ---- Check if there is a host-specific branch

hostname="$(hostname -s)"
if ! [ "$hostname" = "master" ] \
        && ( cd "$HOME/src/dotfiles" && git branch -a | grep "origin/$hostname" ); then
    echo "I: there is a host-specific dotfiles branch for this host"
    echo "I: consider checking it out"
fi