]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - release/rc.local
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / release / rc.local
1 #!/bin/sh
2 # $FreeBSD$
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
11 kbdcontrol -d >/dev/null 2>&1
12 if [ $? -eq 0 ]; then
13         # Syscons: use xterm
14         TERM=xterm
15 else
16         # Serial or other console
17         echo
18         echo "Welcome to FreeBSD!"
19         echo
20         echo "Please choose the appropriate terminal type for your system."
21         echo "Common console types are:"
22         echo "   ansi     Standard ANSI terminal"
23         echo "   vt100    VT100 or compatible terminal"
24         echo "   xterm    xterm terminal emulator (or compatible)"
25         echo
26         echo -n "Console type [vt100]: "
27         read TERM
28         TERM=${TERM:-vt100}
29 fi
30 export TERM
31
32 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
33
34 case $? in
35 $DIALOG_OK)     # Install
36         # If not netbooting, have the installer configure the network
37         dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
38         if [ ${dlv:=0} -eq 0 -a ! -f /etc/diskless ]; then
39                 BSDINSTALL_CONFIGCURRENT=yes; export BSDINSTALL_CONFIGCURRENT
40         fi
41
42         trap true SIGINT        # Ignore cntrl-C here
43         bsdinstall
44         if [ $? -eq 0 ]; then
45                 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
46         else
47                 . /etc/rc.local
48         fi
49         ;;
50 $DIALOG_CANCEL) # Live CD
51         exit 0
52         ;;
53 $DIALOG_EXTRA)  # Shell
54         clear
55         echo "When finished, type 'exit' to return to the installer."
56         /bin/sh
57         . /etc/rc.local
58         ;;
59 esac
60