summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-14 09:06:45 -0200
committerRenato Botelho <renato@netgate.com>2016-01-14 09:06:45 -0200
commit2f1889c9166ffd97b4e64bd9ab4792511e9117ec (patch)
tree6bec1bf96e0b4c2f87ed334ec6806448f07bd65a
parent5be76d387ece734171fabe6ae117dabd6eff769f (diff)
downloadpfsense-2f1889c9166ffd97b4e64bd9ab4792511e9117ec.zip
pfsense-2f1889c9166ffd97b4e64bd9ab4792511e9117ec.tar.gz
Change pfSense-upgrade to return time for reboot so GUI can use it
-rwxr-xr-xsrc/usr/local/sbin/pfSense-upgrade23
-rw-r--r--src/usr/local/www/pkg_mgr_install.php8
2 files changed, 23 insertions, 8 deletions
diff --git a/src/usr/local/sbin/pfSense-upgrade b/src/usr/local/sbin/pfSense-upgrade
index 2ce7421..536bb45 100755
--- a/src/usr/local/sbin/pfSense-upgrade
+++ b/src/usr/local/sbin/pfSense-upgrade
@@ -147,8 +147,12 @@ _exit() {
local _rc=${1:-"0"}
# If EVENT_PIPE is defined, GUI is calling
- [ -n "${progress_socket}" ] \
- && _echo "__RC=${_rc}"
+ if [ -n "${progress_socket}" ]; then
+ local _need_reboot_str=""
+ [ -n "${need_reboot}" ] \
+ && _need_reboot_str=" __REBOOT_AFTER=${reboot_after}"
+ _echo "__RC=${_rc}${_need_reboot_str}"
+ fi
exit ${_rc}
}
@@ -646,11 +650,15 @@ pkg_reinstall_all() {
}
do_reboot() {
- _echo "Upgrade is complete. Rebooting in 10 seconds."
- echo "Upgrade is complete. Rebooting in 10 seconds." | wall
- /etc/rc.notify_message -e -g -m "Upgrade is complete. Rebooting in 10 seconds."
if [ -z "${dont_reboot}" ]; then
- (sleep 10 && /etc/rc.reboot) &
+ _echo "Upgrade is complete. Rebooting in ${reboot_after} seconds."
+ echo "Upgrade is complete. Rebooting in ${reboot_after} seconds." | wall
+ /etc/rc.notify_message -e -g -m "Upgrade is complete. Rebooting in ${reboot_after} seconds."
+ (sleep ${reboot_after} && /etc/rc.reboot) &
+ else
+ _echo "Upgrade is complete."
+ echo "Upgrade is complete." | wall
+ /etc/rc.notify_message -e -g -m "Upgrade is complete."
fi
}
@@ -687,6 +695,9 @@ export chroot_dir=""
# Save nc_pid to be able to kill it
export nc_pid=""
+# Reboot after 10 seconds
+export reboot_after=10
+
unset dry_run
unset dont_reboot
unset booting
diff --git a/src/usr/local/www/pkg_mgr_install.php b/src/usr/local/www/pkg_mgr_install.php
index b603b06..26f44fe 100644
--- a/src/usr/local/www/pkg_mgr_install.php
+++ b/src/usr/local/www/pkg_mgr_install.php
@@ -127,8 +127,12 @@ if ($_REQUEST['ajax']) {
// Log file is read a line at a time so that we can detect/modify certain entries
while (($logline = fgets($logfile)) !== false) {
// Check for return codes and replace with suitable strings
- if (strpos($logline, "_RC=") != false) {
- $code = str_replace("__RC=", "", $logline);
+ if (strpos($logline, "__RC=") == 0) {
+ list($code, $reboot_after) = explode(" ", $logline);
+
+ $code = str_replace("__RC=", "", $code);
+ /* XXX: Implement a GUI timeout counter if (is_numericint($reboot_after)) */
+ $reboot_after = str_replace("__REBOOT_AFTER=", "", $reboot_after);
if ($code == 0) {
$logline = gettext("Success") . "\n";
OpenPOWER on IntegriCloud