diff options
author | Simon Rettberg | 2016-01-05 09:32:58 +0100 |
---|---|---|
committer | root | 2016-01-05 09:32:58 +0100 |
commit | 3c289658bee24ce2f6269430115227f89c0c5b98 (patch) | |
tree | c36000b96c654c0f919a7540b09cd78cf4b9aec6 /remote/setup_target | |
parent | Update wanted kernel config (diff) | |
download | tm-scripts-3c289658bee24ce2f6269430115227f89c0c5b98.tar.gz tm-scripts-3c289658bee24ce2f6269430115227f89c0c5b98.tar.xz tm-scripts-3c289658bee24ce2f6269430115227f89c0c5b98.zip |
[setup_target] Fix cleaning kernel if symlinked to different module name than "kernel"
Diffstat (limited to 'remote/setup_target')
-rwxr-xr-x | remote/setup_target | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/remote/setup_target b/remote/setup_target index 42975ef1..cb42304d 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -500,12 +500,13 @@ clean_modules() { && rm -rf "${TARGET_BUILD_DIR}"/* \ || perror "Error deleting $TARGET_BUILD_DIR" fi + # exclude kernel on "all" set -- $(ls ${TARGET_DIR} | grep -vE "^kernel$") fi cd "$TARGET_DIR" while (( "$#" )); do - clean_module $(readlink -f "$1") + clean_module "${TARGET_DIR}/$1" shift done cd - &> /dev/null @@ -534,34 +535,23 @@ clean_module() { } clean_kernel_module() { - local CLEAN=0 - if [ "x$1" == "x--force" ]; then - CLEAN=1 - else - pinfo "It will take a long time to rebuild, are you sure? [y/N]" - read USER_INPUT - [ "x$USER_INPUT" == "xy" ] && CLEAN=1 + 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 || pwarning "Could not delete ${TARGET_DIR}/kernel/build" fi - - if [[ $CLEAN == 1 ]]; then - 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 || pwarning "Could not delete ${TARGET_DIR}/kernel/build" - fi - # 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 - pinfo "Not confirmed, not cleaning kernel module." + # clean any git repos in nonstandard dirs + find . -maxdepth 1 -type d -name "linux-*" -exec rm -rf -- {} \; + # Clean aufs repo + find . -maxdepth 1 -type d -name "aufs*-*" -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." } # Recursively strip binaries and libraries in the given directory |