blob: 27418c60fcf7ae29f4a007967796f1933880aed4 (
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
|
#! /usr/bin/env bash
set -e
# Default settings
SETTING_DIR=${SETTING_DIR:-~/settings}
REPO=${REPO:-typebrook/settings}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-dev}
RCFILE=${RCFILE:-~/.$(basename $SHELL)rc}
if [ ! -d $SETTING_DIR ]; then
git clone --depth=1 --branch "$BRANCH" "$REMOTE" "$SETTING_DIR" || {
error "git clone of settings repo failed"
exit 1
}
fi
# Write initial commands into .bashrc or .zshrc
sed -i'.bak' "\^# $REPO^, /^$/ d" $RCFILE
cat >>$RCFILE <<EOF
# $REPO
export SETTING_DIR=$SETTING_DIR
source \$SETTING_DIR/tools/init/load-settings.sh
EOF
cd "$SETTING_DIR" || exit 1
git swapprotocol
make
|