blob: cb2135197984b27c0701d2d568a4997afdb79ed5 (
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
|
#! /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
sed -i "\^# $REPO^, /^$/ d" $RCFILE
echo "
# $REPO
export SETTING_DIR=$SETTING_DIR
source \$SETTING_DIR/tools/load-settings.sh
" >> $RCFILE
#cd "$SETTING_DIR" && make
|