Commit 0fd2743e authored by Franco Fichtner's avatar Franco Fichtner

rc: add firmware upgrade bits for major bump

parent 2d2df026
......@@ -29,12 +29,6 @@ LOCKFILE="/tmp/pkg_upgrade.progress"
FLOCK="/usr/local/bin/flock"
ARGS="-n -o ${LOCKFILE}"
if [ ! -f ${FLOCK} ]; then
# backwards-compat to be removed post-16.7
/usr/local/etc/rc.firmware.subr "${@}"
exit 0
fi
if ! ${FLOCK} ${ARGS} /usr/local/etc/rc.firmware.subr "${@}"; then
echo "A firmware update is currently in progress."
fi
......@@ -32,17 +32,26 @@ TEE="/usr/bin/tee -a"
: > ${LOCKFILE}
echo "***GOT REQUEST TO UPGRADE: all***" >> ${LOCKFILE}
# upgrade all packages if possible
opnsense-update -p 2>&1 | ${TEE} ${LOCKFILE}
# trigger a webgui restart to cope with changes
/usr/local/etc/rc.restart_webgui 2>&1 | ${TEE} ${LOCKFILE}
# if we can update base, we'll do that as well
if opnsense-update -c; then
if opnsense-update -bk 2>&1 | ${TEE} ${LOCKFILE}; then
echo "***GOT REQUEST TO UPGRADE***" >> ${LOCKFILE}
if [ -z "${1}" ]; then
# upgrade all packages if possible
opnsense-update -p 2>&1 | ${TEE} ${LOCKFILE}
# trigger a webgui restart to cope with changes
/usr/local/etc/rc.restart_webgui 2>&1 | ${TEE} ${LOCKFILE}
# if we can update base, we'll do that as well
if opnsense-update -c; then
if opnsense-update -bk 2>&1 | ${TEE} ${LOCKFILE}; then
echo '***REBOOT***' >> ${LOCKFILE}
sleep 5
/usr/local/etc/rc.reboot
fi
fi
elif [ "${1}" = "upgrade" -a -n "${2}" ]; then
# upgrade to a major release
if opnsense-update -ur ${2} 2>&1 | ${TEE} ${LOCKFILE}; then
echo '***REBOOT***' >> ${LOCKFILE}
sleep 5
/usr/local/etc/rc.reboot
......
......@@ -27,8 +27,23 @@
set -e
echo "This will automatically fetch all available updates, apply them,"
echo -n "and reboot if necessary. Proceed with this action? [y/N]: "
UPGRADE="/usr/local/opnsense/firmware-upgrade"
ARGS=
if [ -f ${UPGRADE} ]; then
NAME=$(cat ${UPGRADE})
echo "A major firmware upgrade is available for this installation: ${NAME}"
echo
echo "Make sure you have read the release notes and migration guide before"
echo "attempting this upgrade. Around 200MB will need to be downloaded and"
echo -n "require 500MB of free space. Proceed with this action? [y/N]: "
ARGS="upgrade ${NAME}"
else
echo "This will automatically fetch all available updates, apply them,"
echo -n "and reboot if necessary. Proceed with this action? [y/N]: "
fi
read YN
case ${YN} in
......@@ -41,4 +56,4 @@ esac
echo
/usr/local/etc/rc.firmware
/usr/local/etc/rc.firmware ${ARGS}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment