blob: 4552db433d099d63558e678596b83d018bfc1301 (
plain)
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
|
#!/bin/sh
all () {
fast
clean
usb
refl
}
clean () {
paru -aSc --noconfirm
}
# basic daily stuff
fast () {
pac
misc
}
misc () {
"$EDITOR" +PlugClean! +PlugUpdate +qa
rustup update
}
pac () {
pacpacs="$(sudo pacman --noconfirm -Syu | tee /dev/tty | grep '^Packages' | cut -d' ' -f3-)"
aurpacs="$(paru --noconfirm -aSu | tee /dev/tty | grep '^Aur' | cut -d' ' -f3-)"
# part steal from aur comment
# sometimes "ERROR: Failure while downloading": https://github.com/neovim/neovim/issues/15709
# echo 1, printf 1 and yes 1 all works? not sure why
# aur neovim-nightly-bin has some issue on 12/26/2021? switch to community repo neovim temporary
#rm -rf ~/.cache/paru/clone/neovim-nightly-bin/ && echo 1 | PARU_PAGER=cat paru --rebuild --redownload neovim-nightly-bin
pacman -Qqme > "$XDG_CONFIG_HOME/myconf/pacman_Qqme"
pacman -Qqne > "$XDG_CONFIG_HOME/myconf/pacman_Qqne"
systemctl list-unit-files --state=enabled > "$XDG_CONFIG_HOME/myconf/sye"
systemctl --user list-unit-files --state=enabled > "$XDG_CONFIG_HOME/myconf/syue"
# pacdiff default use pacman database, so no need `sudo -E` for find, but will be a little bit slower
log="$log
updated pacman packages: $pacpacs
updated aur packages: $aurpacs
pacdiff: $(pacdiff -o | tr '\n' ' ')
checkrebuild: $(checkrebuild)
"
}
refl () {
# why not use http:
# https://www.reddit.com/r/archlinux/comments/kx149z/should_i_use_http_mirrors/
# https://www.reddit.com/r/archlinux/comments/ej4k4d/is_it_safe_to_use_not_secured_http_pacman_mirrors/
# rsync may need to change XferCommand in /etc/pacman.conf
# https://www.reddit.com/r/archlinux/comments/mynw6e/rsync_mirrors_with_pacman/
# need --delay so no super out of sync mirrors
sudo reflector --verbose --save /etc/pacman.d/mirrorlist --country us --protocol https --delay 1 --latest 25 --score 25 --fastest 10
}
usb () {
cfg -s push
}
if [ $# -eq 0 ]; then
fast
else
while getopts acfmpru opt; do
case $opt in
a)all;;
c)clean;;
f)fast;;
m)misc;;
p)pac;;
r)refl;;
u)usb;;
\?)exit 1;;
esac
done
fi
[ "$log" ] && printf '%s' "$log" | tee "$XDG_DOCUMENTS_DIR/logs/upd.log"
|