-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvup.sh
executable file
·288 lines (230 loc) · 5.81 KB
/
vup.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
#!/bin/bash
#=======================
# 変数定義
#=======================
readonly PRODUCT_VERSION="1.9.0"
PRODUCT_NAME="$(basename "${0}")"
OS_INFO=$(os_info -t)
readonly UBUNTU_OS="OS type: Ubuntu"
readonly ARCH_OS="OS type: Arch Linux"
readonly MAC_OS="OS type: Mac OS"
readonly W_NAME="TanakaPC"
#=======================
# 関数定義
#=======================
# 使い方、ヘルプメッセージ
usage() {
cat <<EOF
$PRODUCT_NAME v$PRODUCT_VERSION
Tools to update various packages and commands. (for mimikun)
Usage:
$PRODUCT_NAME
Options:
--no_pueue, -n Run without pueue
--version, -v, version Print $PRODUCT_NAME version
--help, -h, help Print this help
EOF
}
# バージョン情報出力
version() {
echo "$PRODUCT_NAME v$PRODUCT_VERSION"
}
# magic
before_sudo() {
if ! test "$(
sudo uname >>/dev/null
echo $?
)" -eq 0; then
exit 1
fi
}
# Ubuntu
ubuntu() {
# Upgrade APT repogitory list
sudo apt update
# Upgrade APT packages
sudo apt upgrade -y
# Cleaning APT caches
sudo apt autoremove -y
sudo apt-get clean
}
# Arch Linux
arch() {
paru -Syu
}
# Mac
mac() {
brew_update
}
# OSごとで処理を分岐
os_pkg_update() {
case "$OS_INFO" in
"$UBUNTU_OS") ubuntu ;;
"$MAC_OS") mac ;;
"$ARCH_OS") arch ;;
*) echo "This distro NOT support." ;;
esac
}
use_pueue() {
echo "rustup update"
rust_task_id=$(pueue add -p -- "rustup update")
echo "deno upgrade"
pueue add -- "deno upgrade"
echo "bun upgrade"
pueue add -- "bun upgrade"
echo "mise upgrade"
mise_task_id=$(pueue add -p -- "mise upgrade")
echo "tldr --update"
pueue add -- "tldr --update"
echo "gh extensions upgrade --all"
pueue add -- "gh extensions upgrade --all"
echo "flyctl version upgrade"
pueue add -- "flyctl version upgrade"
echo "update_pnpm"
pueue add -- "update_pnpm"
echo "update mise tools"
pvim_task_id=$(pueue add -p --after "$mise_task_id" -- "update_mise paleovim-master --use-pueue")
pueue add --after "$pvim_task_id" -- "update_mise paleovim-latest --use-pueue"
pueue add --after "$mise_task_id" -- "update_mise zig-master --use-pueue"
echo "update neovim managed by bob"
bob_task_id=$(pueue add -p -- "bob use latest")
bob_task_id=$(pueue add -p --after "$bob_task_id" -- "bob update nightly")
bob_task_id=$(pueue add -p --after "$bob_task_id" -- "bob use nightly")
bob_task_id=$(pueue add -p --after "$bob_task_id" -- "bob update stable")
bob_task_id=$(pueue add -p --after "$bob_task_id" -- "bob update latest")
pueue add --after "$bob_task_id" -- "bob install head"
echo "fisher update"
fish -c 'fisher update'
echo "update_cargo_packages"
cargo_outdated_pkgs=$(cargo install-update -l | grep "Yes" | cut -d " " -f 1)
echo "Update these packages:"
echo "$cargo_outdated_pkgs"
for i in $cargo_outdated_pkgs; do
task_id=$(pueue add -p --after "$rust_task_id" -- "cargo install $i")
done
echo "generate_cargo_package_list"
if [ -n "$task_id" ]; then
pueue add --after "$task_id" -- "generate_cargo_package_list"
else
pueue add -- "generate_cargo_package_list"
fi
echo "update_fish_completions"
update_fish_completions
echo "gup update"
task_id=$(pueue add -p -- "gup update")
echo "gup export"
pueue add --after "$task_id" -- "gup export"
echo "update aqua"
aqua_task_id=$(pueue add -p -- "aqua update-aqua")
aqua_task_id=$(pueue add --after "$aqua_task_id" -p -- "aqua install --all")
aqua_task_id=$(pueue add --after "$aqua_task_id" -p -- "aqua update")
pueue add --after "$aqua_task_id" -- "aqua install --all"
echo "sunbeam extension upgrade --all"
pueue add -- "sunbeam extension upgrade --all"
}
no_pueue() {
echo "rustup update"
rustup update
echo "deno upgrade"
deno upgrade
echo "bun upgrade"
bun upgrade
echo "mise upgrade"
mise upgrade
echo "tldr --update"
tldr --update
echo "gh extensions upgrade --all"
gh extensions upgrade --all
echo "flyctl version upgrade"
flyctl version upgrade
echo "update_pnpm"
update_pnpm
echo "update mise tools"
update_mise paleovim-master
update_mise paleovim-latest
update_mise zig-master
echo "update neovim managed by bob"
bob use latest
bob update nightly
bob use nightly
bob update stable
bob update latest
bob install head
echo "fisher update"
fish -c 'fisher update'
echo "update_cargo_packages"
update_cargo_packages
echo "generate_cargo_package_list"
generate_cargo_package_list
echo "update_fish_completions"
update_fish_completions
echo "gup update"
gup update
echo "gup export"
gup export
echo "update aqua"
aqua update-aqua
aqua install --all
aqua update
aqua install --all
echo "sunbeam extension upgrade --all"
sunbeam extension upgrade --all
}
other() {
echo "update_docker_compose"
update_docker_compose
echo "update_chromedriver"
update_chromedriver
echo "update_geckodriver"
update_geckodriver
echo "update_twitch_cli"
update_twitch_cli
}
w_only() {
if [ $(hostname) == $W_NAME ]; then
echo "This is Work-PC!!!"
echo "Run Work-PC only update tasks"
deps_update
fi
}
reboot_check() {
# ファイルがあれば再起動を促す
if test -e /var/run/reboot-required; then
# WSL かチェックする
if test ! -e /proc/sys/fs/binfmt_misc/WSLInterop; then
echo "\"/var/run/reboot-required\" exists. Reboot the system?(recommend)"
re_boot
fi
fi
}
#=======================
# メイン処理
#=======================
before_sudo
while (("$#")); do
case "$1" in
-h | --help | help)
usage
exit 1
;;
-v | --version | version)
version
exit 1
;;
-s | -n | --no_pueue | no_pueue)
os_pkg_update
no_pueue
other
reboot_check
exit 1
;;
*)
break
;;
esac
done
os_pkg_update
use_pueue
other
w_only
reboot_check