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