generated from anishathalye/dotfiles_template
-
Notifications
You must be signed in to change notification settings - Fork 8
/
install.sh
executable file
·71 lines (61 loc) · 1.34 KB
/
install.sh
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
#!/usr/bin/env bash
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$BASEDIR"/_common-setup.sh
if [ "$EUID" == "0" ]; then
die "Please do not run this script as root"
fi
UPDATE=false
QUICK=false
SHOW_HELP=false
VERBOSE=false
while [[ $# -gt 0 ]]; do
case "$1" in
--update|-u)
UPDATE=true
shift
;;
--quick)
QUICK=true
shift
;;
--help|-h)
SHOW_HELP=true
break
;;
--verbose)
VERBOSE=true
shift
;;
*)
shift
;;
esac
done
eval set -- "$PARSED_ARGS"
if $SHOW_HELP; then
cat <<EOF
Installs the dotfiles.
Usage:
`readlink -f "$0"` [flags]
Flags:
-u, --update Will download and install/reinstall even if the tools are already installed
--verbose Show verbose output
--quick Only does the dotbot install, no other setup
-h, --help help
EOF
exit 0
fi
if $VERBOSE; then
writeGreen "Running `basename "$0"` $ALL_ARGS
Update is $UPDATE"
fi
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DOTBOT_DIR="$BASEDIR/dotbot"
if ! $QUICK; then
writeBlue "Updating dotbot submodules."
pushd "$DOTBOT_DIR" > /dev/null
git submodule update --init --recursive
popd > /dev/null
fi
writeBlue "Working on unpriviledged setup."
"$DOTBOT_DIR/bin/dotbot" -d "${BASEDIR}" -c "$BASEDIR/install.conf.yaml"