diff options
author | Xiao Pan <gky44px1999@gmail.com> | 2024-04-21 22:13:17 -0700 |
---|---|---|
committer | Xiao Pan <gky44px1999@gmail.com> | 2024-04-21 22:13:17 -0700 |
commit | 0c40e003145789e027e69f51425ac4201f369d58 (patch) | |
tree | a5ed25d94d4105790269db8f45877ccf3b427d0f /sh/upd | |
parent | 9e7482a1d28dd912847b8afc9a3cb71288bba8f7 (diff) |
remove ka vps
Diffstat (limited to 'sh/upd')
-rwxr-xr-x | sh/upd | 23 |
1 files changed, 9 insertions, 14 deletions
@@ -4,7 +4,7 @@ all () { fast clean [ "$hostname" != xyzpp ] && refl - if [ "$hostname" = xyzka ] || [ "$hostname" = xyzia ]; then + if [ "$hostname" = xyzia ]; then qb fi [ "$hostname" = xyzinsp ] && music @@ -20,16 +20,16 @@ backup () { esac if [ "$hostname" = xyzinsp ]; then - # Pull repos and branches from studio, so one more backup on insp or duplicity will backup to ka,for one more backup for 321 backup rule + # Pull repos and branches from studio, so one more backup on insp or duplicity will backup to ia,for one more backup for 321 backup rule # cfgl master and pp branches already satisfy 321 rule. Here are three copies: 1. master/pp, 2. studio, 3. gitlab or alternative # But I still copy those on insp because one more copy will not hurt. And all my other data stil satisfy 3 copies without backup to gitlab, so why left out cfgl? Also it may be nice if I what to use that local dir for searching things. cd "$HOME/programs/config_local_arch" || exit 1 git branch | awk '{print ($1=="*")?$2:$1}' | while read -r branch; do git checkout "$branch" git pull - # Push ka and ia branch to codeberg or any future alternative website for mirroring. Needed for public codes/data, considering my death may result in all copies on my computers being lost. + # Push ca and ia branch to codeberg or any future alternative website for mirroring. Needed for public codes/data, considering my death may result in all copies on my computers being lost. case "$branch" in - ka|ia|ca) git push;; + ia|ca) git push;; esac done # git checkout will change mtime, need to change back so rsync won't think it needs to backup these files @@ -41,8 +41,6 @@ backup () { ( umask 077 - # backup ka cfgs - sudo -E git -C /root/programs/config_local_arch_secrets_ka pull # backup studio cfgs, note: it backup a branch by clone/checkout to that branch first sudo -E git -C /root/programs/config_local_arch_secrets pull # backup ia cfgs @@ -57,20 +55,18 @@ backup () { fi if [ "$hostname" = xyzinsp ] || [ "$hostname" = xyzstudio ]; then - # rsync backup from ka - rsync -avPR --delete ka:/home/xyz/.config/qBittorrent :/home/xyz/.local/share/qBittorrent/BT_backup "$HOME/backup/ka" # rsync backup from ia rsync -avPR --delete ia:/home/xyz/.config/qBittorrent :/home/xyz/.local/share/qBittorrent/BT_backup "$HOME/backup/ia" fi - if [ "$hostname" != xyzstudio ] && [ "$hostname" != xyzka ] && [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then + if [ "$hostname" != xyzstudio ] && [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then # rsync backup to studio # --files-from make -a not imply -r, so need to specify explicitly rsync -avPRr --delete --files-from="$XDG_CONFIG_HOME/myconf/upd_rsync_files" / "studio:/home/xyz/backup/$backup_branch" fi - if [ "$hostname" != xyzka ] && [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then - # duplicity backup to ka + if [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then + # duplicity backup to ia # https://wiki.archlinux.org/title/Duplicity # Need // for absolute path, see manpage URL FORMAT section. If not use //, will store to /home/xyz/home/xyz/... # --files-from has a bug, this bug makes source url that is / not working while /home works, more see vq notes @@ -78,7 +74,6 @@ backup () { use_agent= [ "$hostname" = xyzinsp ] && use_agent='--use-agent' sudo duplicity --ssh-askpass $use_agent --encrypt-key 9790577D2BE328D46838117ED3F54FE03F3C68D6 --sign-key 05899270DF25BB1EEDF57BE824F769E5D08C9E9A --full-if-older-than 2Y --include /etc/.cfgs --include-filelist "/home/xyz/.config/myconf/upd_rsync_files" --exclude / / "sftp://xyz@ia.flylightning.xyz//home/xyz/backup/$backup_branch" - sudo duplicity --ssh-askpass $use_agent --encrypt-key 9790577D2BE328D46838117ED3F54FE03F3C68D6 --sign-key 05899270DF25BB1EEDF57BE824F769E5D08C9E9A --full-if-older-than 2Y --include /etc/.cfgs --include-filelist "/home/xyz/.config/myconf/upd_rsync_files" --exclude / / "sftp://xyz@xyzka.kyun.li//home/xyz/backup/$backup_branch" fi } @@ -116,7 +111,7 @@ clean () { fast () { pac misc - if [ "$hostname" != xyzka ] && [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then + if [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then backup fi } @@ -218,7 +213,7 @@ refl () { # 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 - if [ "$hostname" != xyzka ] && [ "$hostname" != xyzia ]; then + if [ "$hostname" != xyzia ]; then sudo reflector --verbose --save /etc/pacman.d/mirrorlist --country us --protocol https --delay 1 --latest 25 --score 25 --fastest 10 else sudo reflector --verbose --save /etc/pacman.d/mirrorlist --country ro --protocol https --delay 1 --fastest 3 |