1761838366

This commit is contained in:
2025-10-30 09:32:46 -06:00
parent 500e541647
commit 16b42e5a31
@@ -1,5 +1,13 @@
#/bin/bash
imgname=`date +"%Y-%m-%d-%H%M-%S"`-pi.img
timestamp=`date +"%Y-%m-%d-%H%M-%S"`
# handle filename
if [ -z "$1" ]; then
imgname=$timestamp-pi.img
else
imgname=$timestamp-$1.img
fi
xzname=$imgname.xz
sizes=sizes-$imgname-$xzame.txt
checksums=sha256sum-$imgname-$xzname.sha256
@@ -23,14 +31,16 @@ webhook "starting copy $dadisk to $imgname to $xzname at $(date)($(date +%s))" t
sudo dd if=$dadisk of=$imgname bs=4M status=progress
imgsize=$(du -h $imgname)
# img sha256
sha256sum $imgname | tee $checksums
# shrink and compress the image
webhook "Copied the disk to $imgname ($imgsize), compressing to $xzname"
sudo pishrink.sh -Z -a $imgname
xzsize=$(du -h $xzname)
# sha256 checksums
# xz sha256
webhook "$imgname ($imgsize) shrunk to $xzname ($xzsize), calculating sha256 checksums..."
sha256sum $imgname | tee $checksums
sha256sum $xzname | tee -a $checksums
# log filesizes
@@ -54,8 +64,8 @@ else
webhook "Archive Test SUCCESS"
fi
# schedule reboot in 1 minute
sudo shutdown -r +1
# finish and notify
webhook "DONE\n\tdisk: $dadisk\n\timgname: $imgname ($imgsize)\n\txzname: $xzname ($xzsize)" true
# schedule reboot in 1 minute
sudo shutdown -r +1