From 277f0fafca4c6f551763ca8738445ef79860beb8 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 7 Oct 2015 13:50:32 +0200 Subject: [setup_target] Fix clean_kernel_module to really clean the kernel --- remote/setup_target | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/remote/setup_target b/remote/setup_target index 63869979..927fde01 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -544,26 +544,16 @@ clean_kernel_module() { pinfo "Cleaning kernel module (including sources and compiled stuff)." cd "${TARGET_DIR}/kernel" || perror "Could not cd to ${TARGET_DIR}/kernel" if [ -e build ]; then - rm -rf build || perror "Could not delete ${TARGET_DIR}/kernel/build" + rm -rf build || pwarning "Could not delete ${TARGET_DIR}/kernel/build" fi - # little workaround to actually list names of entries - # (if only a dir exists, ls kernel/linux-* would just list - # the contents of that directory....) - for FILE in $(ls | grep linux); do - rm -rf $FILE || perror "Could not delete $TARGET_DIR}/$FILE" - done - # finally clean the config generated - if [ -e openslx.config ]; then - rm openslx.config || perror "Could not delete ${TARGET_DIR}/kernel/openslx.config" - fi - if [ -e .fetched_source ]; then - rm .fetched_source || perror "Could not delete ${TARGET_DIR}/kernel/.fetched_source" - fi - if [ -e .built ]; then - rm .built || perror "Could not delete ${TARGET_DIR}/kernel/.built" - fi - if [ -L ksrc ]; then - unlink ksrc || perror "Could not unlink ${TARGET_DIR}/kernel/ksrc." + # clean any git repos in nonstandard dirs + find . -maxdepth 1 -type d -name "linux-*" -exec rm -rf -- {} \; + # clean the config generated and flag files + rm -f -- "openslx.config" ".fetched_source" ".built" + if [ -L "ksrc" ]; then + unlink "ksrc" || perror "Could not unlink ${TARGET_DIR}/kernel/ksrc." + elif [ -d "ksrc" ]; then + rm -rf -- "ksrc" || perror "Could not delete directory ${TARGET_DIR}/kernel/ksrc." fi pinfo "Done cleaning kernel." else -- cgit v1.2.3-55-g7522