Mercurial > hg > zsh-env
comparison 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 |
comparison
equal
deleted
inserted
replaced
173:f8c9b13158b8 | 174:5da4de3d7ee1 |
---|---|
14 MINOR=$2 | 14 MINOR=$2 |
15 MICRO=$3 | 15 MICRO=$3 |
16 if [ $# -gt 3 ]; then | 16 if [ $# -gt 3 ]; then |
17 REVISION=$4 | 17 REVISION=$4 |
18 fi | 18 fi |
19 | |
20 ARCH=`uname -m` | |
21 if [ "$ARCH" = "i686" ]; then | |
22 ARCH="x86" | |
23 fi | |
24 | |
19 LOGFILE=/tmp/removeKernel-$$.log | 25 LOGFILE=/tmp/removeKernel-$$.log |
20 | 26 |
21 # unmerge the kernel | 27 # unmerge the kernel |
22 cd /usr/src | 28 cd /usr/src |
23 KERNEL_DIR="linux-${MAJOR}.${MINOR}.${MICRO}-gentoo" | 29 KERNEL_DIR="linux-${MAJOR}.${MINOR}.${MICRO}-gentoo" |
38 fi | 44 fi |
39 | 45 |
40 # remove modules | 46 # remove modules |
41 cd /lib/modules | 47 cd /lib/modules |
42 LIB_DIR=${MAJOR}.${MINOR}.${MICRO}-gentoo | 48 LIB_DIR=${MAJOR}.${MINOR}.${MICRO}-gentoo |
43 if [ "$REVISION" != "" ]; then | 49 if [[ "$REVISION" != "" ]]; then |
44 LIB_DIR="${LIB_DIR}-${REVISION}" | 50 LIB_DIR="${LIB_DIR}-${REVISION}" |
45 fi | 51 fi |
46 if [ -d $LIB_DIR ]; then | 52 if [[ ! -d $LIB_DIR ]]; then |
47 echo "remove modules from `pwd`/$LIB_DIR" >> $LOGFILE 2>&1 | 53 LIB_DIR="${LIB_DIR}-${ARCH}" |
54 fi | |
55 if [[ -d $LIB_DIR ]]; then | |
56 echo "remove modules from `pwd`/${LIB_DIR}" >> $LOGFILE 2>&1 | |
48 rm -r $LIB_DIR >> $LOGFILE 2>&1 | 57 rm -r $LIB_DIR >> $LOGFILE 2>&1 |
49 fi | 58 fi |
50 | 59 |
51 # remove the kernel and stuff, check if /boot is mounted first | 60 # remove the kernel and stuff, check if /boot is mounted first |
52 MOUNTED=`mount | grep /boot` | 61 MOUNTED=`mount | grep /boot` |
54 echo "mount /boot" >> $LOGFILE 2>&1 | 63 echo "mount /boot" >> $LOGFILE 2>&1 |
55 mount /boot >> $LOGFILE 2>&1 | 64 mount /boot >> $LOGFILE 2>&1 |
56 fi | 65 fi |
57 | 66 |
58 cd /boot | 67 cd /boot |
59 | |
60 ARCH=`uname -m` | |
61 if [ "$ARCH" = "i686" ]; then | |
62 ARCH="x86" | |
63 fi | |
64 | |
65 SUFFIX_V3="genkernel-${ARCH}-${MAJOR}.${MINOR}.${MICRO}" | 68 SUFFIX_V3="genkernel-${ARCH}-${MAJOR}.${MINOR}.${MICRO}" |
66 if [[ "${REVISION}" != "" ]]; then | 69 if [[ "${REVISION}" != "" ]]; then |
67 SUFFIX_V3="${SUFFIX_V3}-${REVISION}" | 70 SUFFIX_V3="${SUFFIX_V3}-${REVISION}" |
68 fi | 71 fi |
69 SUFFIX_V3="${SUFFIX_V3}-gentoo" | 72 SUFFIX_V3="${SUFFIX_V3}-gentoo" |
108 fi | 111 fi |
109 if [[ -f $KERNEL.old ]]; then | 112 if [[ -f $KERNEL.old ]]; then |
110 rm $KERNEL.old >> $LOGFILE 2>&1 | 113 rm $KERNEL.old >> $LOGFILE 2>&1 |
111 fi | 114 fi |
112 | 115 |
116 cd /var/tmp/genkernel | |
117 INITRAMFS="initramfs-${ARCH}-${SUFFIX_V4}" | |
118 if [[ -f ${INITRAMFS} ]]; then | |
119 rm ${INITRAMFS} >> $LOGFILE 2>&1 | |
120 fi | |
121 | |
113 # if we got until here, just remove the logfile again | 122 # if we got until here, just remove the logfile again |
114 rm $LOGFILE | 123 rm $LOGFILE |