diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/install.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/install.sh b/tools/install.sh new file mode 100644 index 0000000..0eb2c5e --- /dev/null +++ b/tools/install.sh | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #! /usr/bin/env bash | ||
| 2 | |||
| 3 | set -e | ||
| 4 | |||
| 5 | # Default settings | ||
| 6 | SETTING_DIR=${SETTING_DIR:-~/settings} | ||
| 7 | REPO=${REPO:-typebrook/settings} | ||
| 8 | REMOTE=${REMOTE:-https://github.com/${REPO}.git} | ||
| 9 | BRANCH=${BRANCH:-dev} | ||
| 10 | RCFILE=${RCFILE:-~/.$(basename $SHELL)rc} | ||
| 11 | |||
| 12 | if [ ! -d $SETTING_DIR ]; then | ||
| 13 | git clone --depth=1 --branch "$BRANCH" "$REMOTE" "$SETTING_DIR" || { | ||
| 14 | error "git clone of settings repo failed" | ||
| 15 | exit 1 | ||
| 16 | } | ||
| 17 | fi | ||
| 18 | |||
| 19 | sed -i "/^$/ N; \^# $REPO^, /^$/ d" $RCFILE | ||
| 20 | echo " | ||
| 21 | # $REPO | ||
| 22 | export SETTING_DIR=$SETTING_DIR | ||
| 23 | source \$SETTING_DIR/tools/load-settings.sh | ||
| 24 | " >> $RCFILE | ||
| 25 | |||
| 26 | cd "$SETTING_DIR" && make | ||