22 lines
532 B
Bash
22 lines
532 B
Bash
#!/bin/bash
|
|
set -e # fail explicitly on any error
|
|
|
|
# todo: interactive, cli options
|
|
disk=/dev/sda
|
|
outname="disk_image_$(date +%Y-%m-%d-%H%M-%Z)"
|
|
outname="$outname.img.xz"
|
|
|
|
# do the disk image dump using inline xz
|
|
echo "runnin inline xz on $disk to file $outname"
|
|
sudo dd if=$disk status=progress bs=1M | xz -c > "$outname"
|
|
|
|
# test xz integrity
|
|
echo "testing disk image integrity"
|
|
xz -t -v "$outname"
|
|
|
|
# make the sha256 file
|
|
echo "generating sha256 checksum file"
|
|
sha256sum "$outname" | tee "$outname.sha256"
|
|
|
|
echo "all donesies :3"
|