firmware: let opnsense-update -u stage the kernel as well

And only replace kernel if the pre-upgrade hook went ok.
This commit is contained in:
Franco Fichtner 2023-06-06 09:36:36 +02:00
parent ea8338767d
commit 41b5e641cf

View File

@ -37,13 +37,15 @@ echo "***GOT REQUEST TO UPGRADE***" >> ${LOCKFILE}
echo "Currently running $(opnsense-version) at $(date)" >> ${LOCKFILE}
${TEE} ${LOCKFILE} < ${PIPEFILE} &
# XXX kernel is not rolled back at the moment, might have to add -K
if opnsense-update -u > ${PIPEFILE} 2>&1; then
${TEE} ${LOCKFILE} < ${PIPEFILE} &
if /usr/local/etc/rc.syshook upgrade > ${PIPEFILE} 2>&1; then
echo '***REBOOT***' >> ${LOCKFILE}
sleep 5
/usr/local/etc/rc.reboot
${TEE} ${LOCKFILE} < ${PIPEFILE} &
if opnsense-update -K > ${PIPEFILE} 2>&1; then
echo '***REBOOT***' >> ${LOCKFILE}
sleep 5
/usr/local/etc/rc.reboot
fi
fi
# aboort pending upgrades