rc.local revision 230482
1#!/bin/sh 2# $FreeBSD: head/release/rc.local 230482 2012-01-23 15:44:52Z nwhitehorn $ 3 4: ${DIALOG_OK=0} 5: ${DIALOG_CANCEL=1} 6: ${DIALOG_HELP=2} 7: ${DIALOG_EXTRA=3} 8: ${DIALOG_ITEM_HELP=4} 9: ${DIALOG_ESC=255} 10 11kbdcontrol -d >/dev/null 2>&1 12if [ $? -eq 0 ]; then 13 # Syscons: use xterm, start interesting things on other VTYs 14 TERM=xterm 15 16 if [ "$EXTERNAL_VTY_STARTED" -ne 1 ]; then 17 vidcontrol -s 2 # Switch to a VTY with no kernel messages 18 # Init will clean these processes up if/when the system 19 # goes multiuser 20 touch /tmp/bsdinstall_log 21 tail -f /tmp/bsdinstall_log > /dev/ttyv2 & 22 /usr/libexec/getty autologin ttyv3 23 EXTERNAL_VTY_STARTED=1 24 trap "vidcontrol -s 1" EXIT 25 fi 26else 27 # Serial or other console 28 echo 29 echo "Welcome to FreeBSD!" 30 echo 31 echo "Please choose the appropriate terminal type for your system." 32 echo "Common console types are:" 33 echo " ansi Standard ANSI terminal" 34 echo " vt100 VT100 or compatible terminal" 35 echo " xterm xterm terminal emulator (or compatible)" 36 echo 37 echo -n "Console type [vt100]: " 38 read TERM 39 TERM=${TERM:-vt100} 40fi 41export TERM 42 43dialog --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 44 45case $? in 46$DIALOG_OK) # Install 47 # If not netbooting, have the installer configure the network 48 dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` 49 if [ ${dlv:=0} -eq 0 -a ! -f /etc/diskless ]; then 50 BSDINSTALL_CONFIGCURRENT=yes; export BSDINSTALL_CONFIGCURRENT 51 fi 52 53 trap true SIGINT # Ignore cntrl-C here 54 bsdinstall 55 if [ $? -eq 0 ]; then 56 dialog --backtitle "FreeBSD Installer" --title "Complete" --yes-label "Reboot" --no-label "Live CD" --yesno "Installation of FreeBSD complete! Would you like to reboot into the installed system now?" 0 0 && reboot 57 else 58 . /etc/rc.local 59 fi 60 ;; 61$DIALOG_CANCEL) # Live CD 62 exit 0 63 ;; 64$DIALOG_EXTRA) # Shell 65 clear 66 echo "When finished, type 'exit' to return to the installer." 67 /bin/sh 68 . /etc/rc.local 69 ;; 70esac 71 72