mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 01:54:49 +00:00
firmware: record packages state for update reboot check for #6940
This way we can see if something changed and reboot if "always reboot" is required. We do the first hash unconditionally because it's fast and maybe we can use this for other purposes as well.
This commit is contained in:
parent
5c7a8fc4fd
commit
fc5536732b
@ -50,8 +50,9 @@ if [ "${SUFFIX}" = "-" ]; then
|
||||
SUFFIX=
|
||||
fi
|
||||
|
||||
# read reboot flag
|
||||
# read reboot flag and record current package name and version state
|
||||
ALWAYS_REBOOT=$(/usr/local/sbin/pluginctl -g system.firmware.reboot)
|
||||
PKGS_HASH=$(pkg query %n-%v 2> /dev/null | sha256)
|
||||
|
||||
# upgrade all packages if possible
|
||||
(opnsense-update ${DO_FORCE} -pt "opnsense${SUFFIX}" 2>&1) | ${TEE} ${LOCKFILE}
|
||||
@ -76,9 +77,11 @@ if opnsense-update ${DO_FORCE} -bk -c > ${PIPEFILE} 2>&1; then
|
||||
fi
|
||||
|
||||
if [ -n "${ALWAYS_REBOOT}" ]; then
|
||||
echo '***REBOOT***' >> ${LOCKFILE}
|
||||
sleep 5
|
||||
/usr/local/etc/rc.reboot
|
||||
if [ "${PKGS_HASH}" != "$(pkg query %n-%v 2> /dev/null | sha256)" ]; then
|
||||
echo '***REBOOT***' >> ${LOCKFILE}
|
||||
sleep 5
|
||||
/usr/local/etc/rc.reboot
|
||||
fi
|
||||
fi
|
||||
|
||||
echo '***DONE***' >> ${LOCKFILE}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user