rc.local revision 245706
1219181Snwhitehorn#!/bin/sh 2219181Snwhitehorn# $FreeBSD: head/release/rc.local 245706 2013-01-21 01:55:54Z 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 11231123SnyanMACHINE=`uname -m` 12231123Snyan 13225637Snwhitehornkbdcontrol -d >/dev/null 2>&1 14225637Snwhitehornif [ $? -eq 0 ]; then 15230482Snwhitehorn # Syscons: use xterm, start interesting things on other VTYs 16231123Snyan if [ ${MACHINE} = "pc98" ]; then 17231123Snyan TERM=cons25w 18231123Snyan else 19231123Snyan TERM=xterm 20231123Snyan fi 21230482Snwhitehorn 22230483Snwhitehorn if [ -z "$EXTERNAL_VTY_STARTED" ]; then 23230482Snwhitehorn # Init will clean these processes up if/when the system 24230482Snwhitehorn # goes multiuser 25230482Snwhitehorn touch /tmp/bsdinstall_log 26230482Snwhitehorn tail -f /tmp/bsdinstall_log > /dev/ttyv2 & 27230997Snwhitehorn /usr/libexec/getty autologin ttyv3 & 28230482Snwhitehorn EXTERNAL_VTY_STARTED=1 29230482Snwhitehorn fi 30225637Snwhitehornelse 31225637Snwhitehorn # Serial or other console 32225637Snwhitehorn echo 33225637Snwhitehorn echo "Welcome to FreeBSD!" 34225637Snwhitehorn echo 35225637Snwhitehorn echo "Please choose the appropriate terminal type for your system." 36225637Snwhitehorn echo "Common console types are:" 37225637Snwhitehorn echo " ansi Standard ANSI terminal" 38225637Snwhitehorn echo " vt100 VT100 or compatible terminal" 39225637Snwhitehorn echo " xterm xterm terminal emulator (or compatible)" 40231123Snyan echo " cons25w cons25w terminal" 41225637Snwhitehorn echo 42225637Snwhitehorn echo -n "Console type [vt100]: " 43225637Snwhitehorn read TERM 44225637Snwhitehorn TERM=${TERM:-vt100} 45225637Snwhitehornfi 46225637Snwhitehornexport TERM 47219181Snwhitehorn 48245706Snwhitehornif [ -f /etc/installerconfig ]; then 49245706Snwhitehorn bsdinstall script /etc/installerconfig 50245706Snwhitehorn if [ $? -eq 0]; then 51245706Snwhitehorn dialog --backtitle "FreeBSD Installer" --title "Complete" --no-cancel --ok-label "Reboot" --pause "Installation of FreeBSD complete! Rebooting in 10 seconds" 10 30 10 52245706Snwhitehorn reboot 53245706Snwhitehorn else 54245706Snwhitehorn dialog --backtitle "FreeBSD Installer" --title "Error" --textbox /tmp/bsdinstall_log 0 0 55245706Snwhitehorn fi 56245706Snwhitehorn exit 57245706Snwhitehornfi 58245706Snwhitehorn 59219181Snwhitehorndialog --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 60219181Snwhitehorn 61219181Snwhitehorncase $? in 62219181Snwhitehorn$DIALOG_OK) # Install 63225637Snwhitehorn # If not netbooting, have the installer configure the network 64225637Snwhitehorn dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` 65225637Snwhitehorn if [ ${dlv:=0} -eq 0 -a ! -f /etc/diskless ]; then 66225637Snwhitehorn BSDINSTALL_CONFIGCURRENT=yes; export BSDINSTALL_CONFIGCURRENT 67225637Snwhitehorn fi 68225637Snwhitehorn 69219181Snwhitehorn trap true SIGINT # Ignore cntrl-C here 70219181Snwhitehorn bsdinstall 71220500Snwhitehorn if [ $? -eq 0 ]; then 72220500Snwhitehorn 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 73220500Snwhitehorn else 74220500Snwhitehorn . /etc/rc.local 75220500Snwhitehorn fi 76219181Snwhitehorn ;; 77219181Snwhitehorn$DIALOG_CANCEL) # Live CD 78219181Snwhitehorn exit 0 79219181Snwhitehorn ;; 80219181Snwhitehorn$DIALOG_EXTRA) # Shell 81219181Snwhitehorn clear 82219181Snwhitehorn echo "When finished, type 'exit' to return to the installer." 83219181Snwhitehorn /bin/sh 84219181Snwhitehorn . /etc/rc.local 85219181Snwhitehorn ;; 86219181Snwhitehornesac 87219181Snwhitehorn 88