diff options
author | Jonathan Bauer | 2013-06-06 13:22:17 +0200 |
---|---|---|
committer | Jonathan Bauer | 2013-06-06 13:22:17 +0200 |
commit | e9fd8aeaabab4a27f3abf4f78b3817649addac80 (patch) | |
tree | 695ce858501a4044e9409a2679aeb965606bd0c4 /remote/setup_target | |
parent | Merge branch 'master' of git:openslx-ng/tm-scripts (diff) | |
download | tm-scripts-e9fd8aeaabab4a27f3abf4f78b3817649addac80.tar.gz tm-scripts-e9fd8aeaabab4a27f3abf4f78b3817649addac80.tar.xz tm-scripts-e9fd8aeaabab4a27f3abf4f78b3817649addac80.zip |
[setup_target] add kernel cleaning (with confirmation\!)
Diffstat (limited to 'remote/setup_target')
-rwxr-xr-x | remote/setup_target | 33 |
1 files changed, 33 insertions, 0 deletions
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 +} |