From e9fd8aeaabab4a27f3abf4f78b3817649addac80 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 6 Jun 2013 13:22:17 +0200 Subject: [setup_target] add kernel cleaning (with confirmation\!) --- remote/setup_target | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'remote') diff --git a/remote/setup_target b/remote/setup_target index 617c409e..2f10b373 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -278,6 +278,7 @@ clean_modules() { set -- $(ls ${TARGET_DIR} | grep -v kernel) fi cd ${TARGET_DIR} + while (( "$#" )); do clean_module $(readlink -f $1) shift @@ -286,6 +287,9 @@ clean_modules() { } clean_module() { + # if kernel is to be cleaned, do it separately and return + [ "x$(basename $1)" == "xkernel" ] && clean_kernel_module && return + pinfo "Cleaning '$1'..." local MODULE_DIR=$1 if [ -e ${MODULE_DIR}/.built ]; then @@ -307,3 +311,32 @@ clean_module() { rm "${MODULE_DIR}/list_binaries_and_files" || perror "Could not delete list_binaries_and_files" fi } + +clean_kernel_module() { + pinfo "Cleaning kernel module (including sources and compiled stuff)." + pinfo "It will take a long time to rebuild, are you sure? [y/N]" + read USER_INPUT + if [ "x$USER_INPUT" == "xy" ]; then + # clean kernel module + 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" + 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 ksrc ]; then + unlink ksrc || perror "Could not unlink ${TARGET_DIR}/kernel/ksrc." + fi + fi +} -- cgit v1.2.3-55-g7522