1
0
mirror of synced 2026-01-11 23:42:56 +00:00
xen-tools.xen-tools/hooks/common/75-fixup-securetty

63 lines
841 B
Bash
Executable File

#!/bin/sh
#
# This script ensures /etc/securetty upon the new guests has the new
# Xen console devices in it
#
# Steve
# --
# https://steve.fi/
prefix=$1
#
# Source our common functions
#
if [ -e /usr/share/xen-tools/common.sh ]; then
. /usr/share/xen-tools/common.sh
else
. ./hooks/common.sh
fi
#
# Log our start
#
logMessage Script $0 starting
#
# If the file doesn't exist exit early.
#
if [ ! -e ${prefix}/etc/securetty ]; then
logMessage /etc/securetty not found.
exit
fi
#
# Do both the devices.
#
for i in xvc0 hvc0 ; do
#
# Only append if not presnt.
#
if ( grep $i ${prefix}/etc/securetty > /dev/null ) ; then
logMessage Host already has $i entry
else
echo $i >> ${prefix}/etc/securetty
fi
done
#
# Log our finish
#
logMessage Script $0 finished.