From d884ac6739126703c7df8a1bf9d07635f1d1af6c Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Mon, 20 Apr 2020 14:27:10 +0200 Subject: show all backups and sizes when run manually --- mkosibuild | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mkosibuild b/mkosibuild index e086365..ec12449 100755 --- a/mkosibuild +++ b/mkosibuild @@ -57,13 +57,18 @@ function main { # Backup old machine [[ -d "${BACKUPDIR}" ]] || mkdir -p "${BACKUPDIR}" if [[ -e ".backup/${NAME}" ]]; then + TS="$(date +%Y%m%d%H%M%S)" echo "" echo "Now zipping up the old machine, for backup" cd "${BACKUPDIR}" if [[ "${CRON:=false}" = false ]] && [[ -x "$(command -v pv)" ]]; then - tar c "${NAME}" | pv -s "$(du -sb "${NAME}" | awk '{print $1}')" | xz -0 - > "${BACKUPDIR}/${NAME}.tar.xz.$(date +%Y%m%d%H%M%S)" + echo "Size of original container: $(du -sh "${BACKUPDIR}/${NAME}" | awk '{print $1}')" + tar c "${NAME}" | pv -s "$(du -sb "${NAME}" | awk '{print $1}')" | xz -0 - > "${BACKUPDIR}/${NAME}.tar.xz.${TS}" + echo "Size of backup: $(du -sh "${BACKUPDIR}/${NAME}.tar.xz.${TS}" | awk '{print $1}')" + echo "All backups of ${NAME}:" + du -sh "${BACKUPDIR}/${NAME}.tar.xz"* else - tar c "${NAME}" | xz -0 - > "${BACKUPDIR}/${NAME}.tar.xz.$(date +%Y%m%d%H%M%S)${CRONSUFFIX:=-cron}" + tar c "${NAME}" | xz -0 - > "${BACKUPDIR}/${NAME}.tar.xz.${TS}${CRONSUFFIX:=-cron}" fi rm -r "${NAME}" fi -- cgit v1.2.3