-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·112 lines (99 loc) · 2.94 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·112 lines (99 loc) · 2.94 KB
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
104
105
106
107
108
109
110
111
112
#!/bin/bash
FORCE_UPGRADE="${FORCE_UPGRADE:-0}"
NONINTERACTIVE="${NONINTERACTIVE:-0}"
MAKE_TIMESTAMP="$(date +%s)"
OS="$(uname -s)"
RESTORE_TIMESTAMP="${RESTORE_TIMESTAMP:-notarealbackuptimestamp}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BIN_DIR="$SCRIPT_DIR/bin"
DOTFILES_DIR="$SCRIPT_DIR/dotfiles"
FONTS_DIR="$SCRIPT_DIR/fonts"
. "$SCRIPT_DIR/lib/install_bin.sh"
. "$SCRIPT_DIR/lib/install_packages.sh"
. "$SCRIPT_DIR/lib/install_dotfiles.sh"
. "$SCRIPT_DIR/lib/install_fonts.sh"
. "$SCRIPT_DIR/lib/setup_git.sh"
install() {
backup
deps "$@"
setup_git
bin_scripts
dotfiles
fonts
}
groups() {
echo
echo '***** Optional Package Groups *****'
echo
list_optional_groups
}
help() {
printf "\nsetup.sh - installs some dotfiles, fonts and useful applications for terminal environments\n\n"
echo "Commands:"
printf "\n Default:\n\n"
printf " install - runs the 'backup', 'deps', 'bin', 'dotfiles', 'fonts' and 'setup_git' targets\n"
printf " install <group...> - same as install, but also installs optional package groups\n"
printf "\n Individual setup:\n\n"
printf " bin - will install scripts from the repo's bin/ directory to '~/bin'\n"
printf " deps - will try to install dependencies\n"
printf " deps <group...> - installs base dependencies plus optional package groups\n"
printf " dotfiles - will install the new dotfiles to '~/'\n"
printf " fonts - will install new fonts to '~/Library/Fonts' on macOS or '~/.local/share/fonts' on other systems\n"
printf " groups - lists available optional package groups for the current OS\n"
printf "\n Utility:\n\n"
printf " backup - will backup current dotfiles to '~/.dotfile_backups/<current timestamp>'\n"
printf " restore - will restore backed up dotfiles, usage 'RESTORE_TIMESTAMP=<desired timestamp> ./setup.sh restore'\n"
printf " setup_git - configures git identity, prompting only when env vars or an existing custom config are unavailable\n"
printf "\n Flags:\n\n"
printf " --help - prints this help information (actually any unknown command will print the help)\n"
printf " Environment: NONINTERACTIVE=1 disables remaining prompts; GIT_NAME/GIT_EMAIL preseed git identity\n"
printf "\n Examples:\n\n"
printf " ./setup.sh deps azure kubernetes\n"
printf " ./setup.sh install aws containers\n"
printf " NONINTERACTIVE=1 GIT_NAME='Jane Doe' GIT_EMAIL='jane@example.com' ./setup.sh install\n"
printf " ./setup.sh groups\n"
echo
}
COMMAND="${1:-install}"
if [ "$#" -gt 0 ]; then
shift
fi
case "$COMMAND" in
backup)
backup
;;
bin)
bin_scripts
;;
deps)
deps "$@"
;;
install)
install "$@"
;;
dotfiles)
dotfiles
;;
fonts)
fonts
;;
groups)
groups
;;
restore)
restore
;;
setup_git)
setup_git
;;
--help | help)
help
;;
*)
help
exit 1
;;
esac
echo
echo "NOTE: you will need to reload your \$SHELL config or open a new terminal for installation to take effect"
echo