#!/bin/sh # $FreeBSD: head/release/rc.local 259686 2013-12-21 16:43:40Z dteske $ MACHINE=`uname -m` kbdcontrol -d >/dev/null 2>&1 if [ $? -eq 0 ]; then # Syscons: use xterm, start interesting things on other VTYs if [ ${MACHINE} = "pc98" ]; then TERM=cons25w else TERM=xterm fi # Don't send ESC on function-key 62/63 (left/right command key) kbdcontrol -f 62 '' > /dev/null 2>&1 kbdcontrol -f 63 '' > /dev/null 2>&1 if [ -z "$EXTERNAL_VTY_STARTED" ]; then # Init will clean these processes up if/when the system # goes multiuser touch /tmp/bsdinstall_log tail -f /tmp/bsdinstall_log > /dev/ttyv2 & /usr/libexec/getty autologin ttyv3 & EXTERNAL_VTY_STARTED=1 fi else # Serial or other console echo echo "Welcome to FreeBSD!" echo echo "Please choose the appropriate terminal type for your system." echo "Common console types are:" echo " ansi Standard ANSI terminal" echo " vt100 VT100 or compatible terminal" echo " xterm xterm terminal emulator (or compatible)" echo " cons25w cons25w terminal" echo echo -n "Console type [vt100]: " read TERM TERM=${TERM:-vt100} fi export TERM echo "FAI FreeBSD installer" file="/etc/installerconfig" if [ -f "$file" -a "$( head -n 1 "$file" )" = "#!fai" ]; then method="installerconfig" fi preseed=$( awk '/bootfile-name/{gsub(/"|;/,"",$3);print $3;exit}' \ /var/db/dhclient.leases.* ) if [ "$preseed" ]; then input="/tmp/fai.conf" # default config fetch "$preseed"/default -o "$input.default" if [ "$( head -n 1 "$input.default" )" = "#!fai" ]; then method="default" fi # mac based config for mac in $( ifconfig | awk '/ether/{print $2}' ); do fetch "$preseed"/"$mac" -o "$input.$mac" if [ "$( head -n 1 "$input.$mac" )" = "#!fai" ]; then method="mac" rightmac="$mac" break fi done fi case "$method" in installerconfig) input="$file" ;; default) input="$input.default" ;; mac) input="$input"."$rightmac" ;; *) echo "No installation method detected, run bsdinstall manually" exit ;; esac if bsdinstall script "$input"; then dialog --backtitle "FreeBSD Installer" --title "Complete" \ --no-cancel --ok-label "Reboot" --pause \ "Installation of FreeBSD complete! Rebooting in 10 seconds" 10 30 10 reboot else dialog --backtitle "FreeBSD Installer" --title "Error" \ --textbox /tmp/bsdinstall_log 0 0 fi