config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

commit bbfa0d4603463fa2094dc766db0d81061700e1bc
parent d1d6446e07701e13e94df26cb48a283c59effced
Author: dwrz <dwrz@dwrz.net>
Date:   Wed,  7 Dec 2022 21:19:48 +0000

Fix backup script

Diffstat:
Mscripts/backup | 15++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/scripts/backup b/scripts/backup @@ -25,18 +25,18 @@ backup-b2() { backup-hosts() { local target="$1" - local t="$2" for h in "${HOSTS[@]}"; do if [[ "${h}" == "mobile" ]]; then + t="${target#"${HOME}"}" rsync --archive --delete --progress --verbose "${target}" \ - "$USER"@"${h}":/data/data/com.termux/files/home/"${t}" + "${USER}@${h}":"/data/data/com.termux/files/home/${t}" else rsync --archive --delete --progress --verbose "${target}" \ - "$USER"@"${h}":/home/"$USER"/"${t}" + "${USER}@${h}":"${target}" fi if [[ "$?" -ne 0 ]]; then - err "$0: failed rsync ${t} to ${h}" + err "$0: failed rsync ${target} to ${h}" fi done } @@ -59,15 +59,12 @@ main() { # Backup targets. for target in "${TARGETS[@]}"; do - local t - t="$(basename "${target}")" - if [[ ! -e "${target}" ]]; then - err "$0: failed to backup ${t}: not found" + err "$0: failed to backup ${target}: not found" continue fi - backup-hosts "${target}" "${t}" + backup-hosts "${target}" done }