/
.sh
executable file
·124 lines (86 loc) · 2.07 KB
/
.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
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
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/sh
# Disable Ctrl-Z
trap '' TSTP
# Prevent System Sleep
/usr/bin/caffeinate -dimu -w $$ &
# Download Repository
if [ "$(basename "${0}")" != '.sh' ]; then
eval "$(/usr/bin/curl --silent --location "https://raw.githubusercontent.com/reitermarkus/dotfiles/HEAD/include/functions/echo.sh")"
echo -b "Downloading Github Repository …"
dotfiles_dir='/tmp/dotfiles-master'
/bin/rm -rf "${dotfiles_dir}"
remove_dotfiles_dir() {
echo -r 'Removing Dotfiles directory …'
/bin/rm -rf "${dotfiles_dir}"
}
trap remove_dotfiles_dir EXIT
/usr/bin/curl --progress-bar --location 'https://github.com/reitermarkus/dotfiles/archive/master.zip' | ditto -xk - '/tmp'
else
dotfiles_dir=$(cd "$(/usr/bin/dirname "$0")" || exit 1; pwd)
fi
# Load Functions
for f in "${dotfiles_dir}/include"/**/*.sh; do
test -f "${f}" && source "${f}"
done
# Ask for superuser password, and add $USER to /etc/sudoers for the duration of the script.
/usr/bin/sudo -E -v || exit 1
USER_SUDOER="${USER} ALL=(ALL) NOPASSWD: ALL"
reset_sudoers() {
echo -b 'Resetting /etc/sudoers …'
/usr/bin/sudo -E -- /usr/bin/sed -i '' "/^${USER_SUDOER}/d" /etc/sudoers
}
if type remove_dotfiles_dir &>/dev/null; then
trap 'remove_dotfiles_dir; reset_sudoers' EXIT
else
trap reset_sudoers EXIT
fi
echo "${USER_SUDOER}" | /usr/bin/sudo -E -- /usr/bin/tee -a /etc/sudoers >/dev/null
# Trap Ctrl-C
trap 'trap "" INT; echo -r "\nAborting …"; cleanup; exit 1' INT
# Run Scripts
install_xcode_clt
install_brew
install_brew_taps
install_brew_formulae
install_ruby_gems
install_npm_packages
install_brew_cask_apps
install_mas_apps
dropbox_link_folders
mackup_relink
run_local_scripts
defaults=(
startup
locale
locate_db
loginwindow
softwareupdate
keyboard
mouse_trackpad
ui_ux
crash_reporter
finder
dock
menubar
bash
bettersnaptool
boom
fish
deliveries
hazel
keka
launchbar
rapidclick
safari
savehollywood
terminal
tower
transmission
xcode
)
for default in "${defaults[@]}";do
defaults_${default}
done
apply_defaults
cleanup
echo -k 'Done.'