Index: release/rc.local =================================================================== --- release/rc.local (revision 284494) +++ release/rc.local (working copy) @@ -53,25 +53,20 @@ export TERM if [ -f /etc/installerconfig ]; then - if bsdinstall script /etc/installerconfig; then - dialog --backtitle "FreeBSD Installer" --title "Complete" --no-cancel --ok-label "Reboot" --pause "Installation of FreeBSD complete! Rebooting in 10 seconds" 10 30 10 - reboot - else - dialog --backtitle "FreeBSD Installer" --title "Error" --textbox /tmp/bsdinstall_log 0 0 - fi - exit + choice=$DIALOG_HELP # Select autoinstall +else + dialog --backtitle "FreeBSD Installer" --title "Welcome" --extra-button --extra-label "Shell" --ok-label "Install" --cancel-label "Live CD" --help-button --help-label "Autoinstall" --yesno "Welcome to FreeBSD! Would you like to begin an installation or use the live CD?" 0 0 + choice=$? fi -dialog --backtitle "FreeBSD Installer" --title "Welcome" --extra-button --extra-label "Shell" --ok-label "Install" --cancel-label "Live CD" --yesno "Welcome to FreeBSD! Would you like to begin an installation or use the live CD?" 0 0 +# If not netbooting, have the installer configure the network +dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` +if [ ${dlv:=0} -eq 0 -a ! -f /etc/diskless ]; then + BSDINSTALL_CONFIGCURRENT=yes; export BSDINSTALL_CONFIGCURRENT +fi -case $? in +case $choice in $DIALOG_OK) # Install - # If not netbooting, have the installer configure the network - dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` - if [ ${dlv:=0} -eq 0 -a ! -f /etc/diskless ]; then - BSDINSTALL_CONFIGCURRENT=yes; export BSDINSTALL_CONFIGCURRENT - fi - trap true SIGINT # Ignore cntrl-C here bsdinstall if [ $? -eq 0 ]; then @@ -89,5 +84,29 @@ /bin/sh . /etc/rc.local ;; +$DIALOG_HELP) # Autoinstall + if [ -f /etc/installerconfig ]; then + installerconfig=/etc/installerconfig + else + installerconfig=/tmp/installerconfig + bsdinstall netconfig + for leasefile in /var/db/dhclient.leases.*; do + [ -e "$leasefile" ] || { dialog --backtitle "FreeBSD Installer" --title "Error" --msgbox "No DHCP lease found" 0 0 && exit; } + configurl=$(sed -E '/^ *filename "(.*)";$/!d;s//\1/;q' $leasefile) && break + done + if ! ftp -Vo "$installerconfig" "$configurl"; then + dialog --backtitle "FreeBSD Installer" --title "Error" --msgbox "URL '$configurl' could not be downloaded for autoinstall" 0 0 + exit + fi + + fi + if bsdinstall script "$installerconfig"; then + dialog --backtitle "FreeBSD Installer" --title "Complete" --no-cancel --ok-label "Reboot" --pause "Installation of FreeBSD complete! Rebooting in 10 seconds" 10 30 10 + reboot + else + dialog --backtitle "FreeBSD Installer" --title "Error" --textbox /tmp/bsdinstall_log 0 0 + fi + exit + ;; esac