Commit 1fd22b65 authored by Franco Fichtner's avatar Franco Fichtner

firmware: polish the upgrade script

parent 8d774567
...@@ -33,24 +33,26 @@ PKG_PROGRESS_FILE=/tmp/pkg_upgrade.progress ...@@ -33,24 +33,26 @@ PKG_PROGRESS_FILE=/tmp/pkg_upgrade.progress
# Truncate upgrade progress file # Truncate upgrade progress file
: > ${PKG_PROGRESS_FILE} : > ${PKG_PROGRESS_FILE}
echo "***GOT REQUEST TO UPGRADE: $package***" >> ${PKG_PROGRESS_FILE}
if [ -z "$pkg_running" ]; then if [ -z "$pkg_running" ]; then
echo "***GOT REQUEST TO UPGRADE: $package***" >> ${PKG_PROGRESS_FILE} echo '***STARTING UPGRADE***' >> ${PKG_PROGRESS_FILE}
if [ "$package" == "all" ]; then if [ "$package" == "all" ]; then
echo '***STARTING UPGRADE***' >> ${PKG_PROGRESS_FILE} # update all installed packages
pkg upgrade -y >> ${PKG_PROGRESS_FILE} pkg upgrade -y >> ${PKG_PROGRESS_FILE}
else # restart the web server
# XXX this is dangerous and not recommended by pkgng devs /usr/local/opnsense/service/configd_ctl.py 'service restart webgui' >> ${PKG_PROGRESS_FILE}
echo '***STARTING UPGRADE - ONE PACKAGE***' >> ${PKG_PROGRESS_FILE} # remove no longer referenced packages
pkg autoremove -y >> ${PKG_PROGRESS_FILE}
elif [ "$package" == "pkg" ]; then
pkg upgrade -y $package >> ${PKG_PROGRESS_FILE} pkg upgrade -y $package >> ${PKG_PROGRESS_FILE}
else
echo "Cannot update $package" >> ${PKG_PROGRESS_FILE}
fi fi
echo '***CHECKING FOR MORE UPGRADES, CAN TAKE 30 SECONDS***' >> ${PKG_PROGRESS_FILE} echo '***CHECKING FOR MORE UPGRADES, CAN TAKE 30 SECONDS***' >> ${PKG_PROGRESS_FILE}
/usr/local/opnsense/scripts/pkg_updatecheck.sh /usr/local/opnsense/scripts/pkg_updatecheck.sh
# remove no longer referenced packages
pkg autoremove -y >> ${PKG_PROGRESS_FILE}
# restart the web server
/usr/local/opnsense/service/configd_ctl.py 'service restart webgui' >> ${PKG_PROGRESS_FILE}
echo '***DONE***' >> ${PKG_PROGRESS_FILE}
else else
echo 'Upgrade already in progress' >> ${PKG_PROGRESS_FILE} echo 'Upgrade already in progress' >> ${PKG_PROGRESS_FILE}
echo '***DONE***' >> ${PKG_PROGRESS_FILE}
fi fi
echo '***DONE***' >> ${PKG_PROGRESS_FILE}
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