From 143281f43cace3898ad507032ecdf11155114dc0 Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Thu, 1 Nov 2001 02:17:49 +0000 Subject: Only overwrite ${DESTDIR}${KODIR}.old/${KERNEL_KO} if we haven't booted from it when doing an installkernel. Only change kern.bootfile from ${DESTDIR}${KODIR}/${KERNEL_KO} to ${DESTDIR}${KODIR}.old/${KERNEL_KO}, and only when we're renaming a booted ${DESTDIR}${KODIR}/${KERNEL_KO} kernel. --- sys/conf/Makefile.pc98 | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'sys/conf/Makefile.pc98') diff --git a/sys/conf/Makefile.pc98 b/sys/conf/Makefile.pc98 index 9990506e90ed..6237801ab0d5 100644 --- a/sys/conf/Makefile.pc98 +++ b/sys/conf/Makefile.pc98 @@ -237,13 +237,20 @@ kernel-install kernel-install.debug: exit 1 ; \ fi .if exists(${DESTDIR}${KODIR}) -.if exists(${DESTDIR}${KODIR}.old) - @-chflags -R noschg ${DESTDIR}${KODIR}.old - -rm -rf ${DESTDIR}${KODIR}.old -.endif - mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old - [ "`sysctl -n kern.bootfile`" != "${DESTDIR}${KODIR}/kernel" ] || \ - sysctl kern.bootfile=${DESTDIR}${KODIR}.old/kernel + -thiskernel=`sysctl -n kern.bootfile` ; \ + if [ "$$thiskernel" = ${DESTDIR}${KODIR}.old/${KERNEL_KO} ] ; then \ + chflags -R noschg ${DESTDIR}${KODIR} ; \ + rm -rf ${DESTDIR}${KODIR} ; \ + else \ + if [ -d ${DESTDIR}${KODIR}.old ] ; then \ + chflags -R noschg ${DESTDIR}${KODIR}.old ; \ + rm -rf ${DESTDIR}${KODIR}.old ; \ + fi ; \ + mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old ; \ + if [ "$$thiskernel" = ${DESTDIR}${KODIR}/${KERNEL_KO} ] ; then \ + sysctl -w kern.bootfile=${DESTDIR}${KODIR}.old/${KERNEL_KO} ; \ + fi; \ + fi .endif mkdir -p ${DESTDIR}${KODIR} install -c -m 555 -o root -g wheel \ -- cgit v1.2.3