Project

General

Profile

Submit #3149 ยป 0001-Add-serial-detection-and-ask-for-TERM-type.patch

ddegroot, 10/18/2018 04:24 AM

View differences:

usr.sbin/installer/installer/installer.sh
# $Id: installer,v 1.20 2005/04/13 03:32:16 cpressey Exp $
### SUBS ###
cleanup()
{
PIDS=`ps aux | grep -e dfuife_curses -e dfuibe_installer | awk '{print $1}'`
for PID in $PIDS; do
# DFUI still running, kill it
kill -9 $PID
done
}
background_backend()
{
......
esac
}
is_serial()
{
# Detect if we are currently connected via a serial console
if [ "X`/usr/bin/kenv console`" == "Xcomconsole" ]; then
return 0 # return success
fi
return 1
}
setup_term()
{
# If TERM has not been set manually (ie: still 'dialup' or from /etc/ttyd), we ask the user what they want to use
if [ "X`tty |cut -c6-9`" == "Xttyd" ]; then
newterm=${TERM}
if [ "X`/usr/bin/kenv smbios.bios.vendor`" == "XSeaBIOS" ]; then
# 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)
newterm="xterm"
elif [ "X${TERM}" == "Xdialup" ]; then
newterm="vt100"
fi
echo ""
echo -n "What is your terminal type (provide value termcap name)? [${newterm}]: "
read input
[ "${input}" = '' ] && input=$newterm
export TERM="${input}"
echo "set new TERM=$TERM"
fi
TTY_BAUD=`stty speed`
if [ $TTY_BAUD -lt 38400 ]; then
echo -n "Your serial connection is quite slow ($TTY_BAUD), causing installer slow down. Continue Anyway ? [Y/n]: "
read input
[ "${input}" == "N" ] || [ "${input}" == "n" ] && exit 0
fi
}
installer_start()
{
# Console start sequence:
......
if [ "X$pfi_frontend" = "Xauto" ]; then
if [ "X$TTY_INST" = "X" ]; then
if $(is_installmedia); then
TTY=/dev/ttyv1
pfi_frontend="cursesvty"
else
if $(is_serial); then
setup_term
RENDEZVOUS="installer"
pfi_dfui_transport="npipe"
TTY=$(tty)
pfi_frontend="curseslog"
else
if $(is_installmedia); then
TTY=/dev/ttyv1
pfi_frontend="cursesvty"
else
TTY=$(tty)
pfi_frontend="curseslog"
fi
fi
else
pfi_frontend="cursesx11"
......
exit 1
fi
trap cleanup EXIT SIGTERM SIGINT
#
# Source directory for the installation
#
    (1-1/1)