Project

General

Profile

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
4 4
# $Id: installer,v 1.20 2005/04/13 03:32:16 cpressey Exp $
5 5

  
6 6
### SUBS ###
7
cleanup()
8
{
9
	PIDS=`ps aux | grep -e dfuife_curses -e dfuibe_installer | awk '{print $1}'`
10
	for PID in $PIDS; do
11
		# DFUI still running, kill it
12
		kill -9 $PID
13
	done
14
}
7 15

  
8 16
background_backend()
9 17
{
......
26 34
	esac
27 35
}
28 36

  
37
is_serial()
38
{
39
	# Detect if we are currently connected via a serial console
40
	if [ "X`/usr/bin/kenv console`" == "Xcomconsole" ]; then
41
		return 0 # return success
42
	fi
43
	return 1
44
}
45

  
46
setup_term()
47
{
48
	# If TERM has not been set manually (ie: still 'dialup' or from /etc/ttyd), we ask the user what they want to use
49
	if [ "X`tty |cut -c6-9`" == "Xttyd" ]; then
50
		newterm=${TERM}
51
		if [ "X`/usr/bin/kenv smbios.bios.vendor`" == "XSeaBIOS" ]; then
52
			# 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)
53
			newterm="xterm"
54
		elif [ "X${TERM}" == "Xdialup" ]; then
55
			newterm="vt100"
56
		fi
57
		echo ""
58
		echo -n "What is your terminal type (provide value termcap name)? [${newterm}]: "
59
		read input
60
		[ "${input}" = '' ] && input=$newterm
61
		export TERM="${input}"
62
		echo "set new TERM=$TERM"
63
	fi
64
	TTY_BAUD=`stty speed`
65
	if [ $TTY_BAUD -lt 38400 ]; then
66
		echo -n "Your serial connection is quite slow ($TTY_BAUD), causing installer slow down. Continue Anyway ? [Y/n]: "
67
		read input
68
		[ "${input}" == "N" ] || [ "${input}" == "n" ] && exit 0
69
	fi
70
}
71

  
29 72
installer_start()
30 73
{
31 74
	# Console start sequence:
......
69 112

  
70 113
	if [ "X$pfi_frontend" = "Xauto" ]; then
71 114
		if [ "X$TTY_INST" = "X" ]; then
72
		    if $(is_installmedia); then
73
				TTY=/dev/ttyv1
74
				pfi_frontend="cursesvty"
75
			else
115
			if $(is_serial); then
116
				setup_term
117
				RENDEZVOUS="installer"
118
				pfi_dfui_transport="npipe"
76 119
				TTY=$(tty)
77 120
				pfi_frontend="curseslog"
121
			else
122
				if $(is_installmedia); then
123
					TTY=/dev/ttyv1
124
					pfi_frontend="cursesvty"
125
				else
126
					TTY=$(tty)
127
					pfi_frontend="curseslog"
128
				fi
78 129
			fi
79 130
		else
80 131
			pfi_frontend="cursesx11"
......
215 266
	exit 1
216 267
fi
217 268

  
269
trap cleanup EXIT SIGTERM SIGINT
270

  
218 271
#
219 272
# Source directory for the installation
220 273
#
221
-