Mercurial > hg > zsh-env
diff removeKernel @ 174:5da4de3d7ee1
remove files from /var/tmp/genkernel and /lib/modules, too
author | Dirk Olmes <dirk.olmes@codedo.de> |
---|---|
date | Thu, 09 Apr 2020 11:21:59 +0200 |
parents | 4500455b2375 |
children | 8af0a6219353 |
line wrap: on
line diff
--- a/removeKernel Sat Apr 04 04:23:36 2020 +0200 +++ b/removeKernel Thu Apr 09 11:21:59 2020 +0200 @@ -16,6 +16,12 @@ if [ $# -gt 3 ]; then REVISION=$4 fi + +ARCH=`uname -m` +if [ "$ARCH" = "i686" ]; then + ARCH="x86" +fi + LOGFILE=/tmp/removeKernel-$$.log # unmerge the kernel @@ -40,11 +46,14 @@ # remove modules cd /lib/modules LIB_DIR=${MAJOR}.${MINOR}.${MICRO}-gentoo -if [ "$REVISION" != "" ]; then +if [[ "$REVISION" != "" ]]; then LIB_DIR="${LIB_DIR}-${REVISION}" fi -if [ -d $LIB_DIR ]; then - echo "remove modules from `pwd`/$LIB_DIR" >> $LOGFILE 2>&1 +if [[ ! -d $LIB_DIR ]]; then + LIB_DIR="${LIB_DIR}-${ARCH}" +fi +if [[ -d $LIB_DIR ]]; then + echo "remove modules from `pwd`/${LIB_DIR}" >> $LOGFILE 2>&1 rm -r $LIB_DIR >> $LOGFILE 2>&1 fi @@ -56,12 +65,6 @@ fi cd /boot - -ARCH=`uname -m` -if [ "$ARCH" = "i686" ]; then - ARCH="x86" -fi - SUFFIX_V3="genkernel-${ARCH}-${MAJOR}.${MINOR}.${MICRO}" if [[ "${REVISION}" != "" ]]; then SUFFIX_V3="${SUFFIX_V3}-${REVISION}" @@ -110,5 +113,11 @@ rm $KERNEL.old >> $LOGFILE 2>&1 fi +cd /var/tmp/genkernel +INITRAMFS="initramfs-${ARCH}-${SUFFIX_V4}" +if [[ -f ${INITRAMFS} ]]; then + rm ${INITRAMFS} >> $LOGFILE 2>&1 +fi + # if we got until here, just remove the logfile again rm $LOGFILE