Fix serial console on VM to work on F13 (REQUIRES F13)

This commit is contained in:
Joanna Rutkowska 2010-06-18 01:45:27 +02:00
parent 5b5de14bc0
commit 0f07b7c7e1
4 changed files with 31 additions and 54 deletions

View File

@ -1,42 +0,0 @@
# 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 *
stop on runlevel [016]
instance
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 $1
end script
exec /sbin/agetty -l /sbin/qubes_serial_login /dev/$1 $2 vt100-nav
post-stop script
if [ "$UPSTART_EVENT" != "${UPSTART_EVENT##fedora.serial-console-available}" ]; then
initctl emit --no-wait fedora.serial-console-available $1 $2
fi
end script

21
common/serial.conf Normal file
View File

@ -0,0 +1,21 @@
# 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/init/tty.conf, and changing the getty line in that file.
start on fedora.serial-console-available DEV=* and stopped rc RUNLEVEL=[2345]
stop on runlevel [016]
instance $DEV
respawn
pre-start exec /sbin/securetty $DEV
exec /sbin/agetty -l /sbin/qubes_serial_login /dev/$DEV $SPEED vt100-nav

View File

@ -72,10 +72,10 @@ cp ../appvm/qubes.repo $RPM_BUILD_ROOT/etc/yum.repos.d
mkdir -p $RPM_BUILD_ROOT/sbin
cp ../common/qubes_serial_login $RPM_BUILD_ROOT/sbin
mkdir -p $RPM_BUILD_ROOT/etc
cp ../common/qubes_eventd_serial $RPM_BUILD_ROOT/etc/
cp ../common/serial.conf $RPM_BUILD_ROOT/var/lib/qubes/
%triggerin -- initscripts
cp /etc/qubes_eventd_serial /etc/event.d/serial
cp /var/lib/qubes/serial.conf /etc/init/serial.conf
%post
@ -88,7 +88,7 @@ fi
usermod -L root
usermod -L user
if ! [ -f /var/lib/qubes/serial.orig ] ; then
cp /etc/event.d/serial /var/lib/qubes/serial.orig
cp /etc/init/serial.conf /var/lib/qubes/serial.orig
fi
echo "--> Disabling SELinux..."
@ -157,7 +157,7 @@ if [ "$1" = 0 ] ; then
chkconfig qubes_core off
mv /var/lib/qubes/fstab.orig /etc/fstab
mv /var/lib/qubes/removed-udev-scripts/* /etc/udev/rules.d/
mv /var/lib/qubes/serial.orig /etc/event.d
mv /var/lib/qubes/serial.orig /etc/init/serial.conf
fi
%clean
@ -174,10 +174,9 @@ rm -rf $RPM_BUILD_ROOT
/usr/bin/qubes_add_pendrive_script
/etc/udev/rules.d/qubes.rules
/etc/sysconfig/iptables
%dir /var/lib/qubes
/var/lib/qubes
%dir /mnt/incoming
%dir /mnt/outgoing
%dir /mnt/removable
/etc/yum.repos.d/qubes.repo
/sbin/qubes_serial_login
/etc/qubes_eventd_serial

View File

@ -66,10 +66,10 @@ cp ../netvm/qubes.repo $RPM_BUILD_ROOT/etc/yum.repos.d
mkdir -p $RPM_BUILD_ROOT/sbin
cp ../common/qubes_serial_login $RPM_BUILD_ROOT/sbin
mkdir -p $RPM_BUILD_ROOT/etc
cp ../common/qubes_eventd_serial $RPM_BUILD_ROOT/etc/
cp ../common/serial.conf $RPM_BUILD_ROOT/var/lib/qubes/
%triggerin -- initscripts
cp /etc/qubes_eventd_serial /etc/event.d/serial
cp /var/lib/qubes/serial.conf /etc/init/serial.conf
%post
@ -82,7 +82,7 @@ sed 's/^net.ipv4.ip_forward.*/net.ipv4.ip_forward = 1/' -i /etc/sysctl.conf
usermod -L root
usermod -L user
if ! [ -f /var/lib/qubes/serial.orig ] ; then
cp /etc/event.d/serial /var/lib/qubes/serial.orig
cp /etc/init/serial.conf /var/lib/qubes/serial.orig
fi
echo "--> Disabling SELinux..."
@ -151,7 +151,7 @@ if [ "$1" = 0 ] ; then
chkconfig qubes_core off
mv /var/lib/qubes/fstab.orig /etc/fstab
mv /var/lib/qubes/removed-udev-scripts/* /etc/udev/rules.d/
mv /var/lib/qubes/serial.orig /etc/event.d
mv /var/lib/qubes/serial.orig /etc/init/serial.conf
fi
%clean
@ -162,10 +162,9 @@ rm -rf $RPM_BUILD_ROOT
/etc/fstab
/etc/sysconfig/iptables
/etc/init.d/qubes_core
%dir /var/lib/qubes
/var/lib/qubes
/usr/bin/qubes_setup_dnat_to_ns
/etc/dhclient.d/qubes_setup_dnat_to_ns.sh
/etc/NetworkManager/dispatcher.d/qubes_nmhook
/etc/yum.repos.d/qubes.repo
/sbin/qubes_serial_login
/etc/qubes_eventd_serial