3 # installer - start installer frontend and backend as per pfi config.
4 # $Id: installer,v 1.20 2005/04/13 03:32:16 cpressey Exp $
9 killall -q dfuife_curses dfuibe_installer
35 # Detect if we are currently connected via a serial console
36 if [ "X`/usr/bin/kenv -q console`" == "Xcomconsole" ]; then
37 return 0 # return success
44 # If TERM has not been set manually (ie: still 'dialup' or from /etc/ttyd), we ask the user what they want to use
45 if [ "X`tty |cut -c6-9`" == "Xttyd" ]; then
47 if [ "X`/usr/bin/kenv smbios.bios.vendor`" == "XSeaBIOS" ]; then
48 # installation on a virtial machine uses this type of simulated bios often, so we can do better than vt100 (eg:vt220-co, vt320-co, cons50-w)
50 elif [ "X${TERM}" == "Xdialup" ]; then
54 echo -n "What is your terminal type (provide value termcap name)? [${newterm}]: "
56 [ "${input}" = '' ] && input=$newterm
57 export TERM="${input}"
58 echo "set new TERM=$TERM"
61 if [ $TTY_BAUD -lt 38400 ]; then
62 echo -n "Your serial connection is quite slow ($TTY_BAUD), causing installer slow down. Continue Anyway ? [Y/n]: "
64 [ "${input}" == "N" ] || [ "${input}" == "n" ] && exit 0
70 # Console start sequence:
71 # - Backend (and all other logging) goes to console (ttyv0)
72 # - curses frontend starts on ttyv1.
73 # - Uses vidcontrol -s 2 to switch to ttyv1 once the frontend is up.
75 echo -n "Starting installer. "
77 if [ -r /etc/defaults/pfi.conf ]; then
78 . /etc/defaults/pfi.conf
81 if [ -r /etc/pfi.conf ]; then
82 echo "Reading /etc/pfi.conf ..."
85 echo "/etc/pfi.conf not found, starting interactive install."
88 # We can set up any install variables and such
89 # here by examining pfi_* variables.
91 if [ "X$pfi_run" != "X" ]; then
96 case "X$pfi_dfui_transport" in
98 RENDEZVOUS="installer"
104 echo "Unsupported DFUI transport '$pfi_dfui_transport'."
109 if [ "X$pfi_frontend" = "Xauto" ]; then
110 if [ "X$TTY_INST" = "X" ]; then
111 if $(is_serial); then
113 RENDEZVOUS="installer"
114 pfi_dfui_transport="npipe"
116 pfi_frontend="curseslog"
118 if $(is_installmedia); then
120 pfi_frontend="cursesvty"
123 pfi_frontend="curseslog"
127 pfi_frontend="cursesx11"
131 case "X$pfi_frontend" in
136 -t $pfi_dfui_transport
143 -t $pfi_dfui_transport
147 ps auwwwxxx > /tmp/ps.txt
148 if grep -q dfuife_curses /tmp/ps.txt; then
149 # Frontend is already running.
151 ESCDELAY=$pfi_curses_escdelay \
152 /usr/sbin/dfuife_curses \
154 -t $pfi_dfui_transport \
155 -b /usr/share/installer/fred.txt \
156 2>/dev/ttyv0 <$TTY >$TTY &
160 vidcontrol -s 2 </dev/ttyv0
164 -t $pfi_dfui_transport
167 killall dfuife_curses
168 vidcontrol -s 1 </dev/ttyv0
171 ps auwwwxxx > /tmp/ps.txt
172 if grep -q dfuife_curses /tmp/ps.txt; then
173 # Frontend is already running.
175 ESCDELAY=$pfi_curses_escdelay \
176 /usr/sbin/dfuife_curses \
178 -t $pfi_dfui_transport \
179 -b /usr/share/installer/fred.txt \
180 2>/tmp/dfuife_curses.log <$TTY >$TTY &
187 -t $pfi_dfui_transport \
191 killall -q dfuife_curses
194 ps auwwwxxx > /tmp/ps.txt
195 if grep -q dfuife_curses /tmp/ps.txt; then
196 echo "Frontend is already running"
198 ESCDELAY=$pfi_curses_escdelay \
199 /usr/sbin/dfuife_curses \
201 -t $pfi_dfui_transport \
202 -b /usr/share/installer/fred.txt \
203 >$TTY_INST <$TTY_INST 2>&1 &
210 -t $pfi_dfui_transport
213 killall dfuife_curses
219 echo "Unknown installer frontend '$pfi_frontend'."
228 $pfi_shutdown_command
237 local _ttyv1=$(grep -w "^ttyv1" /etc/ttys)
238 local guest=$(sysctl -n kern.vmm_guest)
241 # ttyv1 isn't configured for the install media so use
242 # that as a clue for now. Vkernels will be forced
243 # to use 'curseslog' to avoid polluting its only
246 [ "${guest}" = "vkernel" ] && return 1;
248 if [ -z "${_ttyv1}" ]; then
249 return 0 # Return success, it's a USB image, ISO etc.
257 if [ $# -gt 1 ]; then
258 echo "usage: installer [source_directory]"
260 elif [ $# = 1 -a ! -d $1 ]; then
261 echo "source_directory does not exist or is no directory"
265 trap cleanup EXIT SIGTERM SIGINT
268 # Source directory for the installation
276 ps auwwwxxx > /tmp/ps.txt
277 if grep -q dfuibe_installer /tmp/ps.txt; then
278 # Installer is already running. Log in normally.
285 ### END of installer ###