diff options
author | Andreas Fankhauser hiddenalpha.ch | 2022-12-29 02:47:39 +0100 |
---|---|---|
committer | Andreas Fankhauser hiddenalpha.ch | 2022-12-29 02:47:39 +0100 |
commit | aa1095b44a1971be4cac921c67a74c29cf7b2be6 (patch) | |
tree | b1557b3b01a6c4f8642411c62a4ac2bc59c580da | |
parent | 2284b5d648b74ecc9c93aed446697338afc42538 (diff) | |
download | UnspecifiedGarbage-aa1095b44a1971be4cac921c67a74c29cf7b2be6.zip UnspecifiedGarbage-aa1095b44a1971be4cac921c67a74c29cf7b2be6.tar.gz |
(bkup-rsync) Make "latest" link relative
-rwxr-xr-x | src/main/shell/BackupByRsync/backup.sh | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/shell/BackupByRsync/backup.sh b/src/main/shell/BackupByRsync/backup.sh index 7dca2d2..e557d45 100755 --- a/src/main/shell/BackupByRsync/backup.sh +++ b/src/main/shell/BackupByRsync/backup.sh @@ -15,7 +15,6 @@ readonly DIR_FROM="/home/${USER:?}/." readonly DST_PREFIX="${DIR_FROM:?}" readonly DIR_TO="/mnt/x/ROOT_DIR/bkup-rsync/tux-six" readonly BACKUP_PATH="${DIR_TO}/${NOW_SHORT}" -readonly LATEST_LINK="${DIR_TO}/latest" printHelp () { @@ -53,7 +52,7 @@ run () { fi mkdir -p "${BACKUP_PATH:?}/${DST_PREFIX:?}" rsync --archive --verbose \ - --link-dest "${LATEST_LINK:?}/${DST_PREFIX:?}" \ + --link-dest "${DIR_TO}/latest/${DST_PREFIX:?}" \ --filter=':- .gitignore' \ --exclude=".git/COMMIT_EDITMSG" \ --exclude=".git/FETCH_HEAD" \ @@ -121,8 +120,10 @@ run () { "${DIR_FROM:?}" \ "${BACKUP_PATH:?}/${DST_PREFIX}" \ ; - rm "${LATEST_LINK}" - ln --symbolic "${BACKUP_PATH}" "${LATEST_LINK}" + (cd "${DIR_TO:?}" && + rm -f latest && + ln --symbolic "${NOW_SHORT:?}" latest + ) } |