summaryrefslogtreecommitdiff
path: root/scripts/live-bottom/22serialtty
blob: a8008eb387884a66d9a9790a4bfcacf34c44c11a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh

#set -e

# initramfs-tools header

PREREQ=""

prereqs()
{
	echo "${PREREQ}"
}

case "${1}" in
	prereqs)
		prereqs
		exit 0
		;;
esac

# live-initramfs header

# this bottom script currently only works with upstart
if [ ! -d /root/etc/init ]
then
	exit 0
fi

. /scripts/live-functions

# live-initramfs script

for ARGUMENT in $(cat /proc/cmdline)
do
	case ${ARGUMENT} in
		serialtty=*)
			tty="${ARGUMENT#serialtty=}"

			log_begin_msg "Setting up a serial tty..."

cat > /root/etc/init/${tty}.conf <<EOF
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec /sbin/getty -L 115200 ${tty} vt100
EOF

			log_end_msg
			;;
	esac
done