From 689c09af1873ce08eed57a5d32a0895096d0fe55 Mon Sep 17 00:00:00 2001 From: Xiao Pan Date: Fri, 28 Jun 2024 23:10:47 -0700 Subject: upd copy ca mirrorlist to aa because now aa wg to ca --- sh/upd | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'sh/upd') diff --git a/sh/upd b/sh/upd index 3359d91..a126220 100755 --- a/sh/upd +++ b/sh/upd @@ -3,7 +3,9 @@ all () { fast clean - [ "$hostname" != xyzpp ] && refl + if [ "$hostname" != xyzpp ] && [ "$hostname" != xyzaa ]; then + refl + fi if [ "$hostname" = xyzia ]; then qb fi @@ -11,6 +13,7 @@ all () { if [ "$hostname" = xyzinsp ] || [ "$hostname" = xyzpp ]; then userjs fi + monthly_misc } backup () { @@ -220,7 +223,8 @@ refl () { # need --delay so no super out of sync mirrors case "$hostname" in xyzia) sudo reflector --verbose --save /etc/pacman.d/mirrorlist --country ro --protocol https --delay 1 --fastest 3;; - # aa now default wireguard to ca so use us mirrorlist is ok + # aa now default wireguard to ca, so I choose to copy ca mirrorlist to aa instead + # old cn mirrorlists code, only 2 cn mirror servers satisfied `--delay 1`, https://mirrors.jlu.edu.cn/archlinux/$repo/os/$arch is better than https://mirrors.neusoft.edu.cn/archlinux/$repo/os/$arch , the latter had issues #xyzaa) sudo reflector --verbose --save /etc/pacman.d/mirrorlist --country cn --protocol https --delay 1 --fastest 2;; *) sudo reflector --verbose --save /etc/pacman.d/mirrorlist --country us --protocol https --delay 1 --latest 25 --score 25 --fastest 10;; esac @@ -232,12 +236,21 @@ music () { rsync -avP --delete "$XDG_MUSIC_DIR/favorite" pp:/home/xyz/music } +monthly_misc () { + if [ "$hostname" = xyzinsp ]; then + if scp ca:/etc/pacman.d/mirrorlist aa:/tmp; then + echo 'Wait for xyzaa sudo prompt and enter password:' + ssh -t aa 'sudo mv /tmp/mirrorlist /etc/pacman.d/mirrorlist && sudo chown root:root /etc/pacman.d/mirrorlist' + fi + fi +} + hostname="$(hostname)" [ "$hostname" = xyzpp ] && gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type nothing if [ $# -eq 0 ]; then fast else - while getopts abcfjmMpqr opt; do + while getopts abcfjmMopqr opt; do case $opt in a)all;; b)backup;; @@ -246,6 +259,7 @@ else j)userjs;; m)misc;; M)music;; + o)monthly_misc;; p)pac;; q)qb;; r)refl;; -- cgit v1.2.3-70-g09d2