blob: 9d6ad0ef6f4a50ae66d20861ed0d43a56ac61c03 (
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
|
# Automatically start a configured serial console
#
# How this works:
#
# On boot, a udev helper examines /dev/console. If a serial console is the
# primary console (last console on the commandline in grub), the event
# 'fedora.serial-console-available <port name> <speed>' is emitted, which
# triggers this script. It waits for the runlevel to finish, ensures
# the proper port is in /etc/securetty, and starts the getty.
#
# If your serial console is not the primary console, or you want a getty
# on serial even if it's not the console, create your own event by copying
# /etc/event.d/tty[2-6], and changing the getty line in that file.
start on fedora.serial-console-available DEV=*
stop on runlevel [016]
instance $DEV
pre-start script
while /bin/true ; do
LANG=C /sbin/initctl status rcS | grep -wq "rcS stop/waiting" && break
sleep 1
done
while /bin/true ; do
runlevel=$(/sbin/runlevel | /bin/awk '{ print $2 }')
case "$runlevel" in
2|3|4|5)
LANG=C /sbin/initctl status rc$runlevel | grep -wq "rc$runlevel stop/waiting" && break
;;
*)
;;
esac
sleep 1
done
/sbin/securetty $DEV
end script
exec /sbin/agetty /dev/$DEV $SPEED vt100-nav
post-stop script
if [ "$UPSTART_EVENTS" != "${UPSTART_EVENTS##fedora.serial-console-available}" ]; then
initctl emit --no-wait fedora.serial-console-available DEV=$DEV SPEED=$SPEED
fi
end script
|