-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·73 lines (63 loc) · 1.57 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
#!/data/data/com.termux/files/usr/bin/env bash
# Enable bash's unofficial strict mode
GITROOT=$(git rev-parse --show-toplevel)
# shellcheck disable=SC1091
. "${GITROOT}"/lib/strict-mode
strictMode
# shellcheck disable=SC1091
. "${GITROOT}"/lib/utils
THIS_SCRIPT=$(basename "${0}")
#PADDING=$(printf %-${#THIS_SCRIPT}s " ")
function usage() {
msg_info "Usage:"
msg_info "${THIS_SCRIPT} -i <Optional, 'y' or 'n'>"
echo
msg_error "Sets up base termux system"
msg_fatal "-i avoids asking you every time if you want to install something or not"
}
# Ensure dependencies are present
if ! command -v git &>/dev/null; then
msg_fatal "[-] Dependencies unmet. Please verify that the following are installed and in the PATH: git"
fi
MACHINE_OS="$(get_operatingsystem)"
export DEBIAN_FRONTEND='noninteractive'
INSTALL_EVERYTHING='n'
ASK='y'
while [[ $# -gt 0 ]]; do
case "${1}" in
-i|--install-everything)
INSTALL_EVERYTHING='y'
shift # past argument
;;
-y|--yes)
ASK='n'
shift # past argument
;;
-h|--help)
usage
;;
-*)
echo "Unknown option ${1}"
usage
;;
esac
done
# Installing basics
# shellcheck disable=SC1090,SC1091
. "${GITROOT}/${MACHINE_OS}/base"
is_asdf_installed "${ASK:-''}"
# Actual dot-files
declare -a LINKS=('bashrc'
'bash_aliases'
'envrc'
'gitconfig'
'ohmyposh.json'
'tool-versions'
'vimrc')
for LINK in "${LINKS[@]}"; do
link_if_not_exists "${GITROOT}/${LINK}" "${HOME}/.${LINK}"
done
if [[ "${INSTALL_EVERYTHING}" == 'y' ]]; then
install_everything_else
fi
msg_info "I'm done!"