rc.local revision 225637
1#!/bin/sh
2# $FreeBSD: head/release/rc.local 225637 2011-09-17 09:25:45Z 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
14	TERM=xterm
15else
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}
29fi
30export TERM
31
32dialog --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
34case $? 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	;;
59esac
60
61