-
Notifications
You must be signed in to change notification settings - Fork 0
/
update
executable file
·91 lines (79 loc) · 1.52 KB
/
update
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
#!/usr/bin/env bash
source "./lib/variables"
updateForOs() {
printf "Updating programs\n"
updateShared
case "$(uname -s)" in
Darwin)
printf "Darwin based environment detected\n"
updateMac
;;
CYGWIN*)
printf "Cygwin based environment detected\n"
updateWindows
;;
*)
printf "No environment matched\n"
;;
esac
}
updateShared() {
"$HOME"/.oh-my-zsh/tools/upgrade.sh
vim +PlugUpgrade +PlugUpdate +qa
}
updateWindows() {
powershell -Command "Start-Process 'C:\\ProgramData\\chocolatey\\bin\\cup' 'all -y' -Verb runAs"
powershell -Command "Start-Process 'C:\\Users\\Kevin Suen\\scoop\\shims\\scoop' 'update *'"
powershell -Command "Start-Process 'C:\\tools\\cygwin\\cygwinsetup.exe' '--no-desktop --no-shortcuts --no-startmenu --quiet-mode'"
}
updateMac() {
brew update
brew upgrade
}
updateLocal() {
printf "Updating local programs\n"
local updateLocal="$target/.update.local"
if [[ ! -f "$updateLocal" ]]; then
return
fi
bash "$updateLocal"
}
help() {
cat <<-EOF
Usage: update [COMMAND]
Commands:
all Update shared and OS automatically update based on OS
shared Update shared
windows Update Windows
mac Update Mac
local Update local
EOF
}
process() {
case "$1" in
"all")
updateForOs
updateLocal
;;
"shared")
updateShared
;;
"mac")
updateMac
;;
"windows")
updateWindows
;;
"local")
updateLocal
;;
"help")
help
;;
*)
printf "Not a valid command\n\n"
help
;;
esac
}
process "$@"