i thiiink da img_dump be workan ok nao.. maybe idk
This commit is contained in:
+13
-11
@@ -1,14 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# todo:
|
# todo:
|
||||||
## environment checks for webhook, xz-tools, and pishrink
|
## x environment checks for webhook, xz-tools, and pishrink
|
||||||
### install if not found
|
### install if not found
|
||||||
## sanity checks in cleanup error trap to make sure nothing is wrongly deleted
|
## sanity checks in cleanup error trap to make sure nothing is wrongly deleted
|
||||||
## ERR/TERMINATE traps
|
## x ERR/TERMINATE traps
|
||||||
### NO cleanup trap on EXIT
|
### x NO cleanup trap on EXIT
|
||||||
## finish the pi query
|
## x finish the pi query
|
||||||
## add filename query
|
## add filename query
|
||||||
|
|
||||||
set -e # fail on fuckups to iterate fasterrr
|
set -euo pipefail # fail on fuckups to iterate fasterrr :pope: strict fuk u mode :3
|
||||||
|
|
||||||
timestamp="$(date +%Y-%m-%d-%H%M-%Z)"
|
timestamp="$(date +%Y-%m-%d-%H%M-%Z)"
|
||||||
disk=""
|
disk=""
|
||||||
log="${timestamp}_img_dump_testin.log"
|
log="${timestamp}_img_dump_testin.log"
|
||||||
@@ -24,7 +25,7 @@ check_command() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# check da needed cmds~
|
# check da needed cmds~
|
||||||
for cmd in webhook xz pishrink sha256 sudo; do
|
for cmd in webhook xz pishrink sha256 sudo lsblk dd; do
|
||||||
check_command "$cmd"
|
check_command "$cmd"
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -33,11 +34,12 @@ cleanup () {
|
|||||||
webhook "$0 errored! Cleaning up! seconds: $SECONDS line: $LINENO command: $BASHCOMMAND" true
|
webhook "$0 errored! Cleaning up! seconds: $SECONDS line: $LINENO command: $BASHCOMMAND" true
|
||||||
# supress errors if they not there
|
# supress errors if they not there
|
||||||
# to save me from testing each one or writing a fun :poe:
|
# to save me from testing each one or writing a fun :poe:
|
||||||
rm -f "$img_name" 2>/dev/null
|
for file in "$img_name" "$img_name.sha256" "$img_name.xz" "$img_name.xz.sha256" "$log"; do
|
||||||
rm -f "$img_name.sha256" 2>/dev/null
|
if [ -f "$file" ]; then
|
||||||
rm -f "$img_name.xz" 2>/dev/null
|
echo "Deleting $file"
|
||||||
rm -f "$img_name.xz.sha256" 2>/dev/null
|
sudo rm -f "$file" 2>/dev/null
|
||||||
rm -f "$log" 2>/dev/null
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# cleanup any errant files on error/termination
|
# cleanup any errant files on error/termination
|
||||||
|
|||||||
Reference in New Issue
Block a user