Commit f6944cf1 authored by Franco Fichtner's avatar Franco Fichtner

firmware: merge non-intrusive firmware changes/fixes

parent e559fb9b
...@@ -29,12 +29,6 @@ LOCKFILE="/tmp/pkg_upgrade.progress" ...@@ -29,12 +29,6 @@ LOCKFILE="/tmp/pkg_upgrade.progress"
FLOCK="/usr/local/bin/flock" FLOCK="/usr/local/bin/flock"
ARGS="-n -o ${LOCKFILE}" 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 if ! ${FLOCK} ${ARGS} /usr/local/etc/rc.firmware.subr "${@}"; then
echo "A firmware update is currently in progress." echo "A firmware update is currently in progress."
fi fi
...@@ -28,21 +28,37 @@ ...@@ -28,21 +28,37 @@
set -e set -e
LOCKFILE="/tmp/pkg_upgrade.progress" LOCKFILE="/tmp/pkg_upgrade.progress"
PIPEFILE="/tmp/pkg_upgrade.pipe"
TEE="/usr/bin/tee -a" TEE="/usr/bin/tee -a"
: > ${LOCKFILE} : > ${LOCKFILE}
rm -f ${PIPEFILE}
mkfifo ${PIPEFILE}
echo "***GOT REQUEST TO UPGRADE: all***" >> ${LOCKFILE} echo "***GOT REQUEST TO UPGRADE***" >> ${LOCKFILE}
# upgrade all packages if possible if [ -z "${1}" ]; then
opnsense-update -p 2>&1 | ${TEE} ${LOCKFILE} # upgrade all packages if possible
${TEE} ${LOCKFILE} < ${PIPEFILE} &
opnsense-update -p 2>&1 > ${PIPEFILE}
# trigger a webgui restart to cope with changes # trigger a webgui restart to cope with changes
/usr/local/etc/rc.restart_webgui 2>&1 | ${TEE} ${LOCKFILE} ${TEE} ${LOCKFILE} < ${PIPEFILE} &
/usr/local/etc/rc.restart_webgui 2>&1 > ${PIPEFILE}
# if we can update base, we'll do that as well # if we can update base, we'll do that as well
if opnsense-update -c; then if opnsense-update -c; then
if opnsense-update -bk 2>&1 | ${TEE} ${LOCKFILE}; then ${TEE} ${LOCKFILE} < ${PIPEFILE} &
if opnsense-update -bk 2>&1 > ${PIPEFILE}; 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
${TEE} ${LOCKFILE} < ${PIPEFILE} &
if opnsense-update -ur ${2} 2>&1 > ${PIPEFILE}; then
echo '***REBOOT***' >> ${LOCKFILE} echo '***REBOOT***' >> ${LOCKFILE}
sleep 5 sleep 5
/usr/local/etc/rc.reboot /usr/local/etc/rc.reboot
......
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