changeset 161:4500455b2375

Adjust filenames to the old pattern
author Dirk Olmes <dirk@xanthippe.ping.de>
date Tue, 07 Jan 2020 15:27:52 +0100
parents c35d56590441
children 0bd8976bd5fb
files removeKernel
diffstat 1 files changed, 39 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/removeKernel	Mon Dec 23 11:41:35 2019 +0100
+++ b/removeKernel	Tue Jan 07 15:27:52 2020 +0100
@@ -62,21 +62,53 @@
     ARCH="x86"
 fi
 
-SUFFIX=genkernel-${ARCH}-${MAJOR}.${MINOR}.${MICRO}-gentoo
-if [ "$REVISION" != "" ]; then
-    SUFFIX="$SUFFIX-${REVISION}"
+SUFFIX_V3="genkernel-${ARCH}-${MAJOR}.${MINOR}.${MICRO}"
+if [[ "${REVISION}" != "" ]]; then
+	SUFFIX_V3="${SUFFIX_V3}-${REVISION}"
+fi
+SUFFIX_V3="${SUFFIX_V3}-gentoo"
+
+SUFFIX_V4="${MAJOR}.${MINOR}.${MICRO}"
+if [ "${REVISION}" != "" ]; then
+    SUFFIX_V4="${SUFFIX_V4}-${REVISION}"
+fi
+SUFFIX_V4="${SUFFIX_V4}-gentoo-${ARCH}"
+
+SYSTEM_MAP="System.map-${SUFFIX_V3}"
+if [[ -f $SYSTEM_MAP ]]; then
+	rm ${SYSTEM_MAP} >> $LOGFILE 2>&1
 fi
-rm System.map-${SUFFIX} >> $LOGFILE 2>&1
-rm initramfs-${SUFFIX} >> $LOGFILE 2>&1
+SYSTEM_MAP="System.map-${SUFFIX_V4}"
+if [[ -f ${SYSTEM_MAP} ]]; then
+	rm ${SYSTEM_MAP} >> $LOGFILE 2>&1
+fi
+if [[ -f ${SYSTEM_MAP}.old ]]; then
+	rm ${SYSTEM_MAP}.old >> $LOGFILE 2>&1
+fi
 
-KERNEL="kernel-${SUFFIX}"
+INITRAMFS="initramfs-${SUFFIX_V3}"
+if [[ -f ${INITRAMFS} ]]; then
+	rm ${INITRAMFS} >> $LOGFILE 2>&1
+fi
+INITRAMFS="initramfs-${SUFFIX_V4}"
+if [[ -f ${INITRAMFS} ]]; then
+	rm ${INITRAMFS} >> $LOGFILE 2>&1
+fi
+if [[ -f ${INITRAMFS}.old ]]; then
+	rm ${INITRAMFS}.old >> $LOGFILE 2>&1
+fi
+
+KERNEL="kernel-${SUFFIX_V3}"
 if [[ -f $KERNEL ]]; then
 	rm $KERNEL >> $LOGFILE 2>&1
 fi
-KERNEL="vmlinuz-${MAJOR}.${MINOR}.${MICRO}-gentoo-${ARCH}"
+KERNEL="vmlinuz-${SUFFIX_V4}"
 if [[ -f $KERNEL ]]; then
 	rm $KERNEL >> $LOGFILE 2>&1
 fi
+if [[ -f $KERNEL.old ]]; then
+	rm $KERNEL.old >> $LOGFILE 2>&1
+fi
 
 # if we got until here, just remove the logfile again
 rm $LOGFILE