i thiiink da img_dump be workan ok nao.. maybe idk

This commit is contained in:
2026-05-18 08:38:31 -06:00
parent bca726405e
commit 5c3c632a77
3 changed files with 28 additions and 22 deletions
+23 -17
View File
@@ -1,12 +1,24 @@
#!/bin/bash
set -e # fail on fuckups to iterate fasterrr
timestamp="$(date +%Y-%m-%d-%H%M-%Z)"
disk=""
log="${timestamp}_img_dump_testin.log"
echo > "$log" # initialize to empty
img_name="${timestamp}_Kali-Pi5-1TB-Working.img"
# trap function cleanup
cleanup () {
webhook "img_dump errored! Cleaning up! seconds: $SECONDS line: $LINENO command: $BASHCOMMAND" true
rm -f "$img_name" 2>/dev/null
rm -f "$img_name.sha256" 2>/dev/null
rm -f "$img_name.xz" 2>/dev/null
rm -f "$img_name.xz.sha256" 2>/dev/null
rm -f "$log" 2>/dev/null
}
# cleanup any errant files on error
trap cleanup EXIT
echo -e "\n\n\nSTARTING DUMP OPS\n\n\n"
lsblk
@@ -14,9 +26,6 @@ read -p "Enter Disk Name (ex. sda, sdb no /dev or anything else) " disk_choice
disk="/dev/$disk_choice"
clear
# echo "runnin inline xz"
# sudo dd if=$disk status=progress bs=1M | xz -c > throwaway_image_post0_inline_xz_14052026.img.xz
webhook "runnan raw dd img on $disk at to $img_name using 4M bs size (Script Has Run $SECONDS Seconds)"
sudo dd if="$disk" of="$img_name" status=progress bs=4M | tee -a "$log"
@@ -27,19 +36,11 @@ sudo chmod 660 "$img_name"
webhook "generating sha256 checksum of $img_name (from $disk) to $img_name.sha256 (Script Has Run $SECONDS Seconds)"
sha256sum "$img_name" | tee -a "$img_name.sha256"
### commented out in favor of pishrink
# webhook "xz compressing raw $img_name.xz (Script Has Run $SECONDS Seconds)"
# xz -v "$img_name" | tee -a "$log" # yieldds throwaway_image_raw_dd_img_14052026.img.xz
# if [ -f "$img_name" ]; then
# webhook "$image_name still there! Deleting by force!"
# sudo rm -f "$img_name"
# fi
# -v verbose
# -r use advanced filesystem repair option if the normal one fails
# -Z xz compression
# -a compress using multiple cores
# pishrink
## -v verbose
## -r use advanced filesystem repair option if the normal one fails
## -Z xz compression
## -a compress using multiple cores
webhook "doing pishrink from $img_name ($disk) to $img_name.xz (Script Has Run $SECONDS Seconds)"
pishrink -v -r -Z -a "$img_name"
@@ -49,4 +50,9 @@ xz -t -v "$img_name.xz" | tee -a "$log"
webhook "Generating sha256 checksums of $img_name.xz to $img_name.xz.sha256 (Script Has Run $SECONDS Seconds)"
sha256sum "$img_name.xz" | tee -a "$img_name.xz.sha256"
if [ -f "$img_name" ]; then
webhook "$img_name still there! Deleting by force!"
sudo rm -f "$img_name"
fi
webhook "\n\n\nFUCKING FINAALLY ITS OVER\n\n\n\t$SECONDS Seconds Elapsed\n\tDateTime Started: $timestamp DateTime Finished: $(date +%Y-%m-%d-%H%M-%Z)"