summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xremote/setup_target28
1 files 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