diff --git a/common.d/functions.sh b/common.d/functions.sh index 3b64fd5..1c4c40e 100644 --- a/common.d/functions.sh +++ b/common.d/functions.sh @@ -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 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