-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap
executable file
·81 lines (68 loc) · 1.69 KB
/
bootstrap
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
usage() {
printf "Usage:\n"
printf "\t%s [options]\n" "$0"
printf "Options:\n"
printf "\t-h\tdisplays this message\n"
printf "\t-r\tfetch from remote repo\n"
printf "\t-d\tchange destination (default is \$HOME)\n"
printf "\t-l\tlightweight configuration (for command-line-only environments)\n"
printf "\t-b\tadd configuration for bspwm\n"
printf "\t-m\tadd configuration for macos\n"
}
fetch_remote() {
git pull origin HEAD
git submodule update --init --recursive
}
RSYNC="rsync -a --copy-links"
OPTERR=0
REMOTE=false
SRC="$(dirname "${BASH_SOURCE[0]}")"
DEST="$HOME"
LIGHTWEIGHT=false
MACOS=false
BWPWM=false
while getopts "rd:lmbh" o; do
case "$o" in
r)
REMOTE=true
;;
d)
DEST=$OPTARG
;;
l)
LIGHTWEIGHT=true
;;
m)
MACOS=true
;;
b)
BSPWM=true
;;
h|*)
usage
[ h == "$o" ]
exit $?
;;
esac
done
CURRENT_DIR=$(pwd)
cd "$SRC" || exit 1
$REMOTE && fetch_remote
$RSYNC "./lightweight/" "$DEST"
if $LIGHTWEIGHT; then
cd "$CURRENT_DIR" || exit 1
exit 0
fi
$RSYNC "./common/" "$DEST"
if $MACOS; then
$RSYNC "./common-gui/" "$DEST"
$RSYNC "./macos/" "$DEST"
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.bash/git-completion.bash
curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o ~/.bash/git-prompt.sh
elif $BSPWM; then
$RSYNC "./common-gui/" "$DEST"
$RSYNC "./bspwm/" "$DEST"
fi
cd "$CURRENT_DIR" || exit 1
exit 0