forked from divad12/khan-dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 18
/
mac-setup.sh
executable file
·83 lines (68 loc) · 2.07 KB
/
mac-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
#!/bin/bash
# Bail on any errors
set -e
SCRIPT=$(basename $0)
usage() {
cat << EOF
usage: $SCRIPT [options]
--root <dir> Use specified directory as root (instead of HOME).
--all Install all user apps.
--none Install no user apps.
EOF
}
# Install in $HOME by default, but can set an alternate destination via $1.
ROOT="${ROOT:-$HOME}"
# Process command line arguments
while [[ "$1" != "" ]]; do
case $1 in
-r | --root)
shift
ROOT=$1
;;
-a | --all)
APPS="-a"
;;
-n | --none)
APPS="-n"
;;
-h | --help)
usage
exit 0
;;
*)
usage
exit 1
esac
shift
done
# The directory to which all repositories will be cloned.
REPOS_DIR="$ROOT/khan"
# Derived path location constants
DEVTOOLS_DIR="$REPOS_DIR/devtools"
echo
echo "Running Khan Installation Script 1.2"
if ! sw_vers -productVersion 2>/dev/null | grep -q '^1[0-4]\.' ; then
echo "This is tested on macOS 14 (Sonoma)."
echo
echo "If you find that this works on a newer version of macOS, "
echo "please update this message and the grep of this if statement."
echo
fi
echo "After each statement, either something will open for you to"
echo "interact with, or a script will run for you to use"
echo
echo "Press enter when a download/install is completed to go to"
echo "the next step (including this one)"
if ! echo "$SHELL" | grep -q -e '/bash$' -e '/zsh$' ; then
echo
echo "It looks like you're using a shell other than bash or zsh!"
echo "Other shells are not officially supported. Most things"
echo "should work, but dev-support help is not guaranteed."
fi
read -p "Press enter to continue..."
# TODO(ericbrown): Pass command line arguments below
# Note that ensure parsing arguments (above) doesn't hide anything
# Run setup that requires sudo access
"$DEVTOOLS_DIR"/khan-dotfiles/mac-setup-elevated.sh "$APPS"
# Run setup that does NOT require sudo access
"$DEVTOOLS_DIR"/khan-dotfiles/mac-setup-normal.sh