From 667797a5321402fea1fba35322fe3ea2757d02d7 Mon Sep 17 00:00:00 2001 From: Olli Graf Date: Sun, 15 Mar 2026 14:45:23 +0100 Subject: [PATCH] =?UTF-8?q?L=C3=B6schen=20des=20.img=20Files=20funktionier?= =?UTF-8?q?t=20jetzt=20wieder.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backupsd | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/backupsd b/backupsd index d3d9c46..548338e 100755 --- a/backupsd +++ b/backupsd @@ -2,7 +2,7 @@ BACKUP_REPO="/tank/Backup-Repo" TEMP_DIR="${HOME}/backup" -VERSION="2.10" +VERSION="2.11" #CMD_COMPRESS='pbzip2' CMD_COMPRESS='zstd -T0 -5' verbose=false @@ -23,16 +23,6 @@ then exit 2 fi -cleanup() { - echo "Abbruch durch User. Räume auf.." - if test -f "$FILE"; then - rm "${FILE" - fi - -if test -f "${TEMP_DIR}/${HOSTNAME}.sha256"; then - rm ${TEMP_DIR}/${HOSTNAME}.sha256 ${FILE} -} -trap cleanup exit function isolate_checksum() { checksum=($(echo ${1} | tr " " "\n"[0])) @@ -41,6 +31,19 @@ checksum=($(echo ${1} | tr " " "\n"[0])) echo "${checksum}" } +function cleanup() { + echo "Ende. Räume auf..: ${IMGFILE}" + if [ -f "${IMGFILE}" ]; then + echo "Lösche ${IMGFILE}" + rm "${IMGFILE}" + fi + + if test -f "${TEMP_DIR}/${HOSTNAME}".sha256; then + rm "${TEMP_DIR}/${HOSTNAME}".sha256 + fi +} +trap cleanup exit + function format_date() { tdate=$(date '+%y-%m-%d') @@ -67,6 +70,7 @@ ${CMD_COMPRESS} ${FILE} REPO_DIR="${BACKUP_REPO}/${HOSTNAME}" echo "moving compressed image to repo" if [ ! -d "${REPO_DIR}" ]; then mkdir "${REPO_DIR}"; fi +IMGFILE=${FILE} FILE="${FILE}.zst" mv ${FILE} "${BACKUP_REPO}/${HOSTNAME}"