summaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
Diffstat (limited to 'sh')
-rwxr-xr-xsh/upd23
1 files changed, 12 insertions, 11 deletions
diff --git a/sh/upd b/sh/upd
index 048b0e5..e247dd3 100755
--- a/sh/upd
+++ b/sh/upd
@@ -27,9 +27,11 @@ backup () {
git branch | awk '{print ($1=="*")?$2:$1}' | while read -r branch; do
git checkout "$branch"
git pull
- # 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.
+ # Push ca, ia, and other new vps branches (which means any branches other than master/studio/pp) 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
- ia|ca) git push;;
+ # here, : seems no need
+ master|studio|pp) :;;
+ *) 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,12 +43,10 @@ backup () {
(
umask 077
- # 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
- sudo -E git -C /root/programs/config_local_arch_secrets_ia pull
- # backup ca cfgs
- sudo -E git -C /root/programs/config_local_arch_secrets_ca pull
+ # backup studio and other branches' cfgs, note: it backup a branch by clone/checkout to that branch first
+ for dir in $(sudo find /root/programs -maxdepth 1 -mindepth 1 -type d -name 'config_local_arch_secrets*'); do
+ sudo -E git -C "$dir" pull
+ done
)
# rsync backup from studio to insp
@@ -57,15 +57,16 @@ backup () {
if [ "$hostname" = xyzinsp ] || [ "$hostname" = xyzstudio ]; then
# rsync backup from ia
rsync -avPR --delete ia:/home/xyz/.config/qBittorrent :/home/xyz/.local/share/qBittorrent/BT_backup "$HOME/backup/ia"
+ # In the future, maybe other VPS servers also need bakcup to insp and studio. Now, only ia needs
fi
- if [ "$hostname" != xyzstudio ] && [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then
+ if [ "$hostname" = xyzinsp ] || [ "$hostname" = xyzpp ]; 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" != xyzia ] && [ "$hostname" != xyzca ]; then
+ if [ "$hostname" = xyzinsp ] || [ "$hostname" = xyzstudio ] || [ "$hostname" = xyzpp ]; 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/...
@@ -112,7 +113,7 @@ clean () {
fast () {
pac
misc
- if [ "$hostname" != xyzia ] && [ "$hostname" != xyzca ]; then
+ if [ "$hostname" = xyzinsp ] || [ "$hostname" = xyzstudio ] || [ "$hostname" = xyzpp ]; then
backup
fi
}