-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_system_packages_macos
executable file
·58 lines (50 loc) · 1.08 KB
/
install_system_packages_macos
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
#!/bin/sh
#
# Install interesting packages for OS X.
#
# This assumes that the current user is the user used to install
# packages and has the proper administrator privileges.
set -e
set -u
# package manager
pm=
pm_check=
pm_update=
pm_upgrade=
pm_install=
pm_cleanup=
pm_autoremove=
# check if Homebrew is installed
if [ -z "$(command -v brew 2> /dev/null)" ]; then
printf "warning: Homewbrew (brew) not found.\n" 1>&2
else
pm="brew"
pm_check="${pm} doctor"
pm_update="${pm} update"
pm_upgrade="${pm} upgrade"
pm_install="${pm} bundle"
pm_autoremove="${pm} autoremove"
pm_cleanup="${pm} cleanup -s"
fi
# check if package manager is installed
if [ -z "${pm}" ]; then
prinrf "error: Package manager not found.\n"
exit 1
fi
# update and check packages
${pm_update}
if ! ${pm_check} ; then
printf "warning: Package manager check failed, continue anyway (y/n)?: "
read -r yn
if [ "${yn}" != "y" ]; then
exit 1
fi
fi
${pm_update}
# upgrade existing packages
${pm_upgrade}
# install packages
${pm} bundle
# cleanup
${pm_autoremove}
${pm_cleanup}