1
0
mirror of synced 2026-01-16 00:03:51 +00:00
2010-04-15 02:22:44 +02:00

70 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
#
# This script ensures that the new guest images have a nicely
# populated /dev directory.
#
# Steve
# --
# http://www.steve.org.uk/
prefix=$1
#
# Source our common functions
#
if [ -e /usr/lib/xen-tools/common.sh ]; then
. /usr/lib/xen-tools/common.sh
else
. ./hooks/common.sh
fi
#
# Log our start
#
logMessage Script $0 starting
#
# Test where MAKEDEV is located, assuming /sbin/ as default
#
MAKEDEV = "$prefix/sbin/MAKEDEV"
if [ ! -x $MAKEDEV -a -x "$prefix/dev/MAKEDEV" ]; then
MAKEDEV = "$prefix/dev/MAKEDEV"
fi
#
# Early termination if we have a couple of common devices present
# should speed up installs which use --copy/--tar
#
if ( test `ls -1 ${prefix}/dev | wc -l` -gt 10 ); then
#
# We still need to make sure the basic devices are present
#
cd ${prefix}/dev
$MAKEDEV std
$MAKEDEV hda
$MAKEDEV sda
$MAKEDEV tty1
logMessage "Terminating because there appear to be files in /dev already"
exit
fi
#
# Make the device nodes.
#
cd ${prefix}/dev
$MAKEDEV generic
$MAKEDEV std
#
# Log our finish
#
logMessage Script $0 finished