diff --git a/src/opnsense/scripts/firmware/check.sh b/src/opnsense/scripts/firmware/check.sh index 609a9adf7..8af552ae1 100755 --- a/src/opnsense/scripts/firmware/check.sh +++ b/src/opnsense/scripts/firmware/check.sh @@ -66,6 +66,11 @@ repository="error" sets_upgraded= upgrade_needs_reboot="0" +product_reboot=$(/usr/local/sbin/pluginctl -g system.firmware.reboot) +if [ -n "${product_reboot}" ]; then + needs_reboot="1" +fi + product_suffix="-$(/usr/local/sbin/pluginctl -g system.firmware.type)" if [ "${product_suffix}" = "-" ]; then product_suffix= diff --git a/src/opnsense/scripts/firmware/reboot.sh b/src/opnsense/scripts/firmware/reboot.sh index a4c24a02b..b279b7454 100755 --- a/src/opnsense/scripts/firmware/reboot.sh +++ b/src/opnsense/scripts/firmware/reboot.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2018-2022 Franco Fichtner +# Copyright (C) 2018-2023 Franco Fichtner # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -59,5 +59,10 @@ if [ -n "${LQUERY}" -a -n "${RQUERY}" ]; then fi fi +ALWAYS_REBOOT=$(/usr/local/sbin/pluginctl -g system.firmware.reboot) +if [ -n "${ALWAYS_REBOOT}" ]; then + WANT_REBOOT=0 +fi + # success is reboot: exit ${WANT_REBOOT} diff --git a/src/opnsense/scripts/firmware/update.sh b/src/opnsense/scripts/firmware/update.sh index 061528532..3c747ae29 100755 --- a/src/opnsense/scripts/firmware/update.sh +++ b/src/opnsense/scripts/firmware/update.sh @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2015-2021 Franco Fichtner +# Copyright (C) 2015-2023 Franco Fichtner # Copyright (C) 2014 Deciso B.V. # All rights reserved. # @@ -50,6 +50,9 @@ if [ "${SUFFIX}" = "-" ]; then SUFFIX= fi +# read reboot flag +ALWAYS_REBOOT=$(/usr/local/sbin/pluginctl -g system.firmware.reboot) + # upgrade all packages if possible (opnsense-update ${DO_FORCE} -pt "opnsense${SUFFIX}" 2>&1) | ${TEE} ${LOCKFILE} @@ -72,4 +75,10 @@ if opnsense-update ${DO_FORCE} -bk -c > ${PIPEFILE} 2>&1; then fi fi +if [ -n "${ALWAYS_REBOOT}" ]; then + echo '***REBOOT***' >> ${LOCKFILE} + sleep 5 + /usr/local/etc/rc.reboot +fi + echo '***DONE***' >> ${LOCKFILE} diff --git a/src/opnsense/scripts/firmware/upgrade.sh b/src/opnsense/scripts/firmware/upgrade.sh index 2ccb12baf..34733710f 100755 --- a/src/opnsense/scripts/firmware/upgrade.sh +++ b/src/opnsense/scripts/firmware/upgrade.sh @@ -48,7 +48,7 @@ if opnsense-update -u > ${PIPEFILE} 2>&1; then fi fi - # aboort pending upgrades + # abort pending upgrades opnsense-update -e >> ${LOCKFILE} 2>&1 fi