rc.local revision 225637
1219181Snwhitehorn#!/bin/sh
2219181Snwhitehorn# $FreeBSD: head/release/rc.local 225637 2011-09-17 09:25:45Z nwhitehorn $
3219181Snwhitehorn
4219181Snwhitehorn: ${DIALOG_OK=0}
5219181Snwhitehorn: ${DIALOG_CANCEL=1}
6219181Snwhitehorn: ${DIALOG_HELP=2}
7219181Snwhitehorn: ${DIALOG_EXTRA=3}
8219181Snwhitehorn: ${DIALOG_ITEM_HELP=4}
9219181Snwhitehorn: ${DIALOG_ESC=255}
10219181Snwhitehorn
11225637Snwhitehornkbdcontrol -d >/dev/null 2>&1
12225637Snwhitehornif [ $? -eq 0 ]; then
13225637Snwhitehorn	# Syscons: use xterm
14225637Snwhitehorn	TERM=xterm
15225637Snwhitehornelse
16225637Snwhitehorn	# Serial or other console
17225637Snwhitehorn	echo
18225637Snwhitehorn	echo "Welcome to FreeBSD!"
19225637Snwhitehorn	echo
20225637Snwhitehorn	echo "Please choose the appropriate terminal type for your system."
21225637Snwhitehorn	echo "Common console types are:"
22225637Snwhitehorn	echo "   ansi     Standard ANSI terminal"
23225637Snwhitehorn	echo "   vt100    VT100 or compatible terminal"
24225637Snwhitehorn	echo "   xterm    xterm terminal emulator (or compatible)"
25225637Snwhitehorn	echo
26225637Snwhitehorn	echo -n "Console type [vt100]: "
27225637Snwhitehorn	read TERM
28225637Snwhitehorn	TERM=${TERM:-vt100}
29225637Snwhitehornfi
30225637Snwhitehornexport TERM
31219181Snwhitehorn
32219181Snwhitehorndialog --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
33219181Snwhitehorn
34219181Snwhitehorncase $? in
35219181Snwhitehorn$DIALOG_OK)	# Install
36225637Snwhitehorn	# If not netbooting, have the installer configure the network
37225637Snwhitehorn	dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
38225637Snwhitehorn	if [ ${dlv:=0} -eq 0 -a ! -f /etc/diskless ]; then
39225637Snwhitehorn		BSDINSTALL_CONFIGCURRENT=yes; export BSDINSTALL_CONFIGCURRENT
40225637Snwhitehorn	fi
41225637Snwhitehorn
42219181Snwhitehorn	trap true SIGINT	# Ignore cntrl-C here
43219181Snwhitehorn	bsdinstall
44220500Snwhitehorn	if [ $? -eq 0 ]; then
45220500Snwhitehorn		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
46220500Snwhitehorn	else
47220500Snwhitehorn		. /etc/rc.local
48220500Snwhitehorn	fi
49219181Snwhitehorn	;;
50219181Snwhitehorn$DIALOG_CANCEL)	# Live CD
51219181Snwhitehorn	exit 0
52219181Snwhitehorn	;;
53219181Snwhitehorn$DIALOG_EXTRA)	# Shell
54219181Snwhitehorn	clear
55219181Snwhitehorn	echo "When finished, type 'exit' to return to the installer."
56219181Snwhitehorn	/bin/sh
57219181Snwhitehorn	. /etc/rc.local
58219181Snwhitehorn	;;
59219181Snwhitehornesac
60219181Snwhitehorn
61