summaryrefslogtreecommitdiffstats
path: root/src/usr/local/sbin/pfSense-upgrade
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-11-13 15:26:35 -0200
committerRenato Botelho <renato@netgate.com>2015-11-13 15:26:45 -0200
commit1c114534116b4326f6b64d977fe0461ac56fd7a2 (patch)
tree057515bd3c6f08dc57a060b898c8a43c6429e1ab /src/usr/local/sbin/pfSense-upgrade
parentd86a6c40d92534199b5b558816d1fed45162fb13 (diff)
downloadpfsense-1c114534116b4326f6b64d977fe0461ac56fd7a2.zip
pfsense-1c114534116b4326f6b64d977fe0461ac56fd7a2.tar.gz
Add a new option to force upgrade script to don't reboot
Diffstat (limited to 'src/usr/local/sbin/pfSense-upgrade')
-rwxr-xr-xsrc/usr/local/sbin/pfSense-upgrade31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/usr/local/sbin/pfSense-upgrade b/src/usr/local/sbin/pfSense-upgrade
index f39a0a3..979242b 100755
--- a/src/usr/local/sbin/pfSense-upgrade
+++ b/src/usr/local/sbin/pfSense-upgrade
@@ -57,6 +57,7 @@ usage() {
echo " -h - Show this usage help" >&2
echo " -l - Logfile path (defaults to /cf/conf/upgrade_log.txt)" >&2
echo " -p socket - Write pkg progress to socket"
+ echo " -R - Do not reboot (it can be dangerous)"
echo " -y - Consider yes as the answer for any possible interaction" >&2
echo "" >&2
echo "Following parameters are mutually exclusive:" >&2
@@ -319,10 +320,7 @@ pkg_upgrade() {
fi
fi
switch_active_nanobsd_partition
- _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."
- (sleep 10 && /etc/rc.reboot) &
+ do_reboot
_exit 0
fi
@@ -354,10 +352,7 @@ pkg_upgrade() {
next_stage=2
if [ -n "${need_reboot}" -a "${platform}" != "nanobsd" ]; then
- _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."
- (sleep 10 && /etc/rc.reboot) &
+ do_reboot
_exit 0
fi
fi
@@ -386,10 +381,7 @@ pkg_upgrade() {
if [ -n "${need_reboot}" -a "${platform}" = "nanobsd" ]; then
switch_active_nanobsd_partition
- _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."
- (sleep 10 && /etc/rc.reboot) &
+ do_reboot
_exit 0
fi
@@ -612,6 +604,15 @@ pkg_reinstall_all() {
done
}
+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) &
+ fi
+}
+
pid_file="/var/run/$(basename $0).pid"
last_update_file="/var/run/$(basename $0)-last-update"
logfile="/cf/conf/upgrade_log.txt"
@@ -637,6 +638,7 @@ fi
export pkg_chroot=""
export chroot_dir=""
+unset dont_reboot
unset booting
unset boot_stage
unset force
@@ -647,7 +649,7 @@ unset action
unset action_pkg
unset force_ipv4
unset force_ipv6
-while getopts 46b:cdfi:hp:l:r:uy opt; do
+while getopts 46b:cdfi:hp:l:r:Ruy opt; do
case ${opt} in
4)
if [ -n "${force_ipv6}" ]; then
@@ -710,6 +712,9 @@ while getopts 46b:cdfi:hp:l:r:uy opt; do
action="delete"
action_pkg="${OPTARG}"
;;
+ R)
+ dont_reboot=1
+ ;;
u)
if [ -n "${action}" ]; then
usage
OpenPOWER on IntegriCloud