Index: etc/Makefile =================================================================== --- etc/Makefile +++ etc/Makefile @@ -43,6 +43,7 @@ protocols \ rc \ rc.bsdextended \ + rc.delay \ rc.firewall \ rc.initdiskless \ rc.shutdown \ Index: etc/defaults/rc.conf =================================================================== --- etc/defaults/rc.conf +++ etc/defaults/rc.conf @@ -92,6 +92,12 @@ extra_netfs_types="NO" # List of network extra filesystem types for delayed # mount at startup (or NO). +### Fastboot settings ### +fastboot_enable="NO" +fastboot_delay="10" +fastboot_rc_delay="/etc/rc.d/sshd /etc/rc.d/jail /etc/rc.d/iscsictl /etc/rc.d/ftpd /etc/rc.d/bluetooth" +fastboot_rc_early="" + ############################################################## ### Network configuration sub-section ###################### ############################################################## Index: etc/rc =================================================================== --- etc/rc +++ etc/rc @@ -114,6 +114,48 @@ *) find_local_scripts_new ;; esac +if [ "$fastboot_enable" = "YES" ]; then + # List of rc.d scripts we will start before login + _rc_preload=`rcorder ${skip} ${skip_firstboot} /etc/rc.d/* $fastboot_rc_early 2>/dev/null` + _rc_delay=" $fastboot_rc_delay " + + # Don't wait for devd to do init + export devd_flags="-n $devd_flags" + + # Run the early scripts now + for _rc_elem in $_rc_preload + do + # Do we have something to delay to later? + case "$_rc_delay" in + *" $_rc_elem "*) continue ;; + esac + + # Save list of what we have already run + _rc_elem_run="$_rc_elem_run $_rc_elem " + + # Have we already started this? + case "$_rc_elem_done" in + *" $_rc_elem "*) continue ;; + esac + + # Skip full netif, run this in post + if [ "${_rc_elem}" = "/etc/rc.d/netif" ] ; then + /etc/rc.d/netif start lo0 + elif [ "${_rc_elem}" = "/etc/rc.d/defaultroute" ] ; then + continue + else + run_rc_script ${_rc_elem} ${_boot} + fi + done + + # Start the delayed services after the login is up + (sleep $fastboot_delay ; nice /bin/sh /etc/rc.delay "$_rc_elem_run" "$_rc_network_up")& + + echo '' + date + exit 0 +fi + # The firstboot sentinel might be on a newly mounted filesystem; look for it # again and unset skip_firstboot if we find it. if [ -e ${firstboot_sentinel} ]; then Index: etc/rc.d/mountcritremote =================================================================== --- etc/rc.d/mountcritremote +++ etc/rc.d/mountcritremote @@ -40,6 +40,10 @@ '') ;; *) + if [ "$fastboot_enable" = "YES" -a -z "$_rc_network_up" ] ; then + _enable_full_networking + fi + echo -n 'Mounting NFS file systems:' mount -a -t nfs echo '.' @@ -61,6 +65,10 @@ [ "${fstype}" = "nfs" ] && continue + if [ "$fastboot_enable" = "YES" -a -z "$_rc_network_up" ] ; then + _enable_full_networking + fi + case "`mount -d -a -t ${fstype}`" in *mount_${fstype}*) echo -n "Mounting ${fsdecr} file systems:" Index: etc/rc.subr =================================================================== --- etc/rc.subr +++ etc/rc.subr @@ -2082,6 +2082,17 @@ esac } +# _enable_full_networking +# When using fastboot, is called by by early scripts that require networking to finish +# such as mountcritremote when the user has NFS mounts +_enable_full_networking() +{ + run_rc_script /etc/rc.d/netif restart + run_rc_script /etc/rc.d/defaultroute ${_boot} + _rc_network_up="1" ; export _rc_network_up +} + + fi # [ -z "${_rc_subr_loaded}" ] _rc_subr_loaded=: