-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·103 lines (90 loc) · 2.37 KB
/
setup.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
declare skipQuestions=false
create_symlinks() {
chmod +x ./create_symbolic_links.sh
./create_symbolic_links.sh
chmod +x ./vim/setup.sh
./vim/setup.sh
}
configure_os() {
# Check supported distros
distro=$(echo $(os_distro) | tr '[:upper:]' '[:lower:]' | awk '{print $1}')
case "$distro" in
arch)
;;
fedora)
;;
*)
print_info "Unsupported distribution"
exit 1
esac
#chmod +x ./xorg/setup.sh
#./xorg/setup.sh
chmod +x ./$distro/setup.sh
./$distro/setup.sh
print_info "Git"
git config --global mergetool.keepBackup false
git config --global merge.tool vimdiff
if ! $skipQuestions; then
ask_for_confirmation "Do you want to setup git user and email?"
printf "\n"
if answer_is_yes; then
ask "user.name: "
git config --global user.name "$(get_answer)"
ask "user.email: "
git config --global user.email "$(get_answer)"
fi
fi
}
run_all() {
create_symlinks
configure_os
}
show_help() {
echo "Usage: $(basename "$0") [options]" >&2
echo
echo " -l, --link Create symbolic links"
echo " -c, --config Configures your system (install packages, xorg, keyboard, ...)"
echo " -i, --install Install (extra) software (rtags, youcompleteme, ...)"
echo " -a, --all Does all of the above"
echo
exit 1
}
main() {
# Check that everything runs relative to this file
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
# Load utils
. "utils.sh" || exit 1
skip_questions "$@" \
&& skipQuestions=true
if [ $# -eq 0 ]; then
show_help
else
for i in "$@"
do
case $i in
-l|--link)
create_symlinks
shift
;;
-i|--install)
install_extra
shift
;;
-c|--config)
configure_os
shift
;;
-a|--all)
run_all
shift
;;
*)
show_help
shift
;;
esac
done
fi
}
main "$@"