-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·82 lines (66 loc) · 2.08 KB
/
Copy pathbootstrap
File metadata and controls
executable file
·82 lines (66 loc) · 2.08 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
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname ${BASH_SOURCE[0]})"
self_dir="$(dirname "$(pwd -P)/$(basename ${BASH_SOURCE[0]})")"
cd - 1>/dev/null
preload() {
. "${self_dir}/lib/ask.sh"
. "${self_dir}/lib/log.sh"
. "${self_dir}/scripts/apps.sh"
. "${self_dir}/scripts/brew.sh"
. "${self_dir}/scripts/mas.sh"
. "${self_dir}/scripts/tweaks.sh"
}
valid_profile() {
profiles=(
acrux
antares
pollux
rigel
)
printf '%s\0' "${profiles[@]}" | grep -q -F -x -z -- "${1}"
return $?
}
main() {
preload
ask::construct true
profile_name="${1:-}"
if [[ -n "${profile_name}" ]] ; then
if ! valid_profile "${profile_name}" ; then
log::error "Profile name '${profile_name}' is unknown."
exit 1
fi
else
hostname="$(scutil --get ComputerName)"
if [[ -n "${hostname}" ]] && valid_profile "${hostname}"; then
profile_name="${hostname}"
fi
if [[ -z "${profile_name}" ]] ; then
log::error "Profile name not specified. Run \"./bootstrap <profile_name>\" to specify."
exit 1
fi
fi
log::info "Bootstrap started for profile \"${profile_name}\"."
if ask::interactive "Check macOS Software Updates?"; then
updates=$(softwareupdate -l -a 2>&1)
echo -e "$updates"
if [ -n "$updates" ] && ! echo "$updates" | grep -q "No new software available" && ask::interactive "Install Software Updates?"; then
softwareupdate -i -a
fi
fi
brew::install_homebrew
brew::update
brew::upgrade_core
brew::upgrade_cask "${self_dir}/profiles/${profile_name}/brew_cask_pinned.list"
brew::reconcile "${self_dir}/profiles/${profile_name}/brew.list"
mas::reconcile "${self_dir}/profiles/${profile_name}/mas.list"
#apps::install_go_apps
apps::install_gh_extensions
tweaks::hostname ${profile_name}
tweaks::switch_to_zsh
# TODO: temporary disabled, investigate.
#tweaks::set_screenshots_dir
log::info "Done bootstrapping!"
}
main "$@"
exit 0