Project

General

Profile

« Previous | Next » 

Revision 1c114534

Added by Renato Botelho over 9 years ago

Add a new option to force upgrade script to don't reboot

View differences:

src/usr/local/sbin/pfSense-upgrade
57 57
	echo "	-h          - Show this usage help" >&2
58 58
	echo "	-l          - Logfile path (defaults to /cf/conf/upgrade_log.txt)" >&2
59 59
	echo "	-p socket   - Write pkg progress to socket"
60
	echo "	-R          - Do not reboot (it can be dangerous)"
60 61
	echo "	-y          - Consider yes as the answer for any possible interaction" >&2
61 62
	echo "" >&2
62 63
	echo "Following parameters are mutually exclusive:" >&2
......
319 320
				fi
320 321
			fi
321 322
			switch_active_nanobsd_partition
322
			_echo "Upgrade is complete.  Rebooting in 10 seconds."
323
			echo "Upgrade is complete.  Rebooting in 10 seconds." | wall
324
			/etc/rc.notify_message -e -g -m "Upgrade is complete.  Rebooting in 10 seconds."
325
			(sleep 10 && /etc/rc.reboot) &
323
			do_reboot
326 324
			_exit 0
327 325
		fi
328 326

  
......
354 352
		next_stage=2
355 353

  
356 354
		if [ -n "${need_reboot}" -a "${platform}" != "nanobsd" ]; then
357
			_echo "Upgrade is complete.  Rebooting in 10 seconds."
358
			echo "Upgrade is complete.  Rebooting in 10 seconds." | wall
359
			/etc/rc.notify_message -e -g -m "Upgrade is complete.  Rebooting in 10 seconds."
360
			(sleep 10 && /etc/rc.reboot) &
355
			do_reboot
361 356
			_exit 0
362 357
		fi
363 358
	fi
......
386 381

  
387 382
		if [ -n "${need_reboot}" -a "${platform}" = "nanobsd" ]; then
388 383
			switch_active_nanobsd_partition
389
			_echo "Upgrade is complete.  Rebooting in 10 seconds."
390
			echo "Upgrade is complete.  Rebooting in 10 seconds." | wall
391
			/etc/rc.notify_message -e -g -m "Upgrade is complete.  Rebooting in 10 seconds."
392
			(sleep 10 && /etc/rc.reboot) &
384
			do_reboot
393 385
			_exit 0
394 386
		fi
395 387

  
......
612 604
	done
613 605
}
614 606

  
607
do_reboot() {
608
	_echo "Upgrade is complete.  Rebooting in 10 seconds."
609
	echo "Upgrade is complete.  Rebooting in 10 seconds." | wall
610
	/etc/rc.notify_message -e -g -m "Upgrade is complete.  Rebooting in 10 seconds."
611
	if [ -z "${dont_reboot}" ]; then
612
		(sleep 10 && /etc/rc.reboot) &
613
	fi
614
}
615

  
615 616
pid_file="/var/run/$(basename $0).pid"
616 617
last_update_file="/var/run/$(basename $0)-last-update"
617 618
logfile="/cf/conf/upgrade_log.txt"
......
637 638
export pkg_chroot=""
638 639
export chroot_dir=""
639 640

  
641
unset dont_reboot
640 642
unset booting
641 643
unset boot_stage
642 644
unset force
......
647 649
unset action_pkg
648 650
unset force_ipv4
649 651
unset force_ipv6
650
while getopts 46b:cdfi:hp:l:r:uy opt; do
652
while getopts 46b:cdfi:hp:l:r:Ruy opt; do
651 653
	case ${opt} in
652 654
		4)
653 655
			if [ -n "${force_ipv6}" ]; then
......
710 712
			action="delete"
711 713
			action_pkg="${OPTARG}"
712 714
			;;
715
		R)
716
			dont_reboot=1
717
			;;
713 718
		u)
714 719
			if [ -n "${action}" ]; then
715 720
				usage

Also available in: Unified diff