diff --git a/src/opnsense/scripts/firmware/update.sh b/src/opnsense/scripts/firmware/update.sh index 3c747ae29..bff139c27 100755 --- a/src/opnsense/scripts/firmware/update.sh +++ b/src/opnsense/scripts/firmware/update.sh @@ -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}