aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Eriksen <d@ennis.no>2020-04-20 14:27:10 +0200
committerDennis Eriksen <d@ennis.no>2020-04-20 14:27:10 +0200
commitd884ac6739126703c7df8a1bf9d07635f1d1af6c (patch)
tree2aa8e70961afcf2fdd5105d14057febce80d1c7f
parentchanging logging a bit (diff)
downloadmkosibuild-d884ac6739126703c7df8a1bf9d07635f1d1af6c.tar.gz
show all backups and sizes when run manually
-rwxr-xr-xmkosibuild9
1 files 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