functions: Fix cleanup. Add clean raw images

This commit is contained in:
timoxa0 2024-11-02 22:31:46 +05:00
parent 33f25c2762
commit 019eb296bc

View file

@ -71,10 +71,16 @@ arguments() {
case "$(echo ${opt} | tr '[:upper:]' '[:lower:]')" in case "$(echo ${opt} | tr '[:upper:]' '[:lower:]')" in
-c | --cleanup) -c | --cleanup)
cleanup ;; cleanup
break 2;;
-r | --cleanraw)
cleanraw
break 2;;
-h | -help | --help) -h | -help | --help)
usage ;; usage
break 2;;
*) *)
export LNIBUILD="$opt" export LNIBUILD="$opt"
@ -94,10 +100,13 @@ usage() {
# Cleanup # Cleanup
$0 --cleanup or $0 -c $0 --cleanup or $0 -c
# Clean raw images
$0 --cleanraw or -r
# Build LNIBUILD # Build LNIBUILD
$0 <path/to/LNIBUILD> $0 <path/to/LNIBUILD>
EOF EOF
exit 0 return 0
} }
# shellcheck disable=SC2162 # shellcheck disable=SC2162
@ -106,7 +115,7 @@ cleanup()
source ./common.d/build_functions.sh source ./common.d/build_functions.sh
find ./tmp/ -mindepth 1 -maxdepth 1 | read || { find ./tmp/ -mindepth 1 -maxdepth 1 | read || {
[ -z ${quiet+x} ] && log "Nothing to clean" error [ -z ${quiet+x} ] && log "Nothing to clean" error
exit 0 return 0
} }
for d in ./tmp/*/; do for d in ./tmp/*/; do
@ -117,7 +126,12 @@ cleanup()
umount "$d" umount "$d"
rm -d "$d" rm -d "$d"
done done
exit 0 return 0
}
cleanraw()
{
rm ./raw/* -f
} }
# shellcheck disable=SC2317 # shellcheck disable=SC2317