summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-04-28 19:10:47 +0100
committerLyndon Brown <jnqnfe@gmail.com>2020-05-15 19:36:51 +0000
commit263f84fe801f1664150673158495f26c9ce5ab32 (patch)
treefb5de5b92c68a0dc9c521230bb6c963815bff25e
parentfca128314754d937510312ce41ac39ae5d4d8125 (diff)
downloadvyos-live-build-263f84fe801f1664150673158495f26c9ce5ab32.tar.gz
vyos-live-build-263f84fe801f1664150673158495f26c9ce5ab32.zip
clean: handle all common options
support for options like `--debug` was missing. Gbp-Dch: Short
-rwxr-xr-xscripts/build/clean30
1 files changed, 17 insertions, 13 deletions
diff --git a/scripts/build/clean b/scripts/build/clean
index 8851305b0..b28cdcd2d 100755
--- a/scripts/build/clean
+++ b/scripts/build/clean
@@ -23,7 +23,7 @@ fi
# Setting static variables
DESCRIPTION="Clean up system build directories"
-USAGE="${PROGRAM} [--all] [--cache] [--chroot] [--binary] [--purge] [--remove] [--stage] [--source]"
+USAGE="${PROGRAM} [--all] [--cache] [--chroot] [--binary] [--purge] [--remove] [--stage] [--source] [COMMON_OPTIONS]"
# Reading, preparing and validating config
Read_conffiles $(Common_conffiles)
@@ -39,11 +39,10 @@ fi
Remove_lockfile
-if [ $# -eq 0 ]; then
- set -- "--all"
-fi
+ACTION_SELECTED="false"
for ARGUMENT in "${@}"; do
+ IS_ACTION="true"
case "${ARGUMENT}" in
--all)
RM_ALL="true"
@@ -77,17 +76,19 @@ for ARGUMENT in "${@}"; do
RM_SOURCE="true"
;;
- -h|--help)
- Man
- ;;
-
- -u|--usage)
- Usage --exit
+ *)
+ IS_ACTION="false"
;;
+ esac
+ if [ "${IS_ACTION}" = "true" ]; then
+ ACTION_SELECTED="true"
+ continue
+ fi
- -v|--version)
- echo "${VERSION}"
- exit 0
+ case "${ARGUMENT}" in
+ --breakpoints|--color|--debug|--force|-h|--help|--no-color|--quiet|-u|--usage|--verbose|-v|--version)
+ Handle_common_option "${ARGUMENT}"
+ shift
;;
*)
@@ -96,6 +97,9 @@ for ARGUMENT in "${@}"; do
;;
esac
done
+if [ "${ACTION_SELECTED}" = "false" ]; then
+ RM_ALL="true"
+fi
STAGEFILES_DIR="$(Stagefiles_dir)"