rc.local revision 230997
1#!/bin/sh
2# $FreeBSD: head/release/rc.local 230997 2012-02-04 23:00:27Z 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 [ -z "$EXTERNAL_VTY_STARTED" ]; then
17		# Init will clean these processes up if/when the system
18		# goes multiuser
19		touch /tmp/bsdinstall_log
20		tail -f /tmp/bsdinstall_log > /dev/ttyv2 &
21		/usr/libexec/getty autologin ttyv3 &
22		EXTERNAL_VTY_STARTED=1
23	fi
24else
25	# Serial or other console
26	echo
27	echo "Welcome to FreeBSD!"
28	echo
29	echo "Please choose the appropriate terminal type for your system."
30	echo "Common console types are:"
31	echo "   ansi     Standard ANSI terminal"
32	echo "   vt100    VT100 or compatible terminal"
33	echo "   xterm    xterm terminal emulator (or compatible)"
34	echo
35	echo -n "Console type [vt100]: "
36	read TERM
37	TERM=${TERM:-vt100}
38fi
39export TERM
40
41dialog --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
42
43case $? in
44$DIALOG_OK)	# Install
45	# If not netbooting, have the installer configure the network
46	dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
47	if [ ${dlv:=0} -eq 0 -a ! -f /etc/diskless ]; then
48		BSDINSTALL_CONFIGCURRENT=yes; export BSDINSTALL_CONFIGCURRENT
49	fi
50
51	trap true SIGINT	# Ignore cntrl-C here
52	bsdinstall
53	if [ $? -eq 0 ]; then
54		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
55	else
56		. /etc/rc.local
57	fi
58	;;
59$DIALOG_CANCEL)	# Live CD
60	exit 0
61	;;
62$DIALOG_EXTRA)	# Shell
63	clear
64	echo "When finished, type 'exit' to return to the installer."
65	/bin/sh
66	. /etc/rc.local
67	;;
68esac
69
70