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