"target" is also the name used in the debian installer for the installation target while "prefix" is too ambiguous.
75 lines
1.2 KiB
Bash
Executable File
75 lines
1.2 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/
|
|
|
|
|
|
TARGET=$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
|
|
|
|
#
|
|
# Test where MAKEDEV is located, assuming /sbin/ as default
|
|
#
|
|
MAKEDEV=''
|
|
MAKEDEV_PATHS="/sbin/MAKEDEV /dev/MAKEDEV"
|
|
for MAKEDEV_PATH in ${MAKEDEV_PATHS}; do
|
|
if [ -x "${TARGET}${MAKEDEV_PATH}" ]; then
|
|
MAKEDEV="${TARGET}${MAKEDEV_PATH}"
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [ -n "${MAKEDEV}" ]; then
|
|
|
|
#
|
|
# Early termination if we have a couple of common devices present
|
|
# should speed up installs which use --copy/--tar
|
|
#
|
|
if ( test `ls -1 ${TARGET}/dev | wc -l` -gt 10 ); then
|
|
#
|
|
# We still need to make sure the basic devices are present
|
|
#
|
|
cd ${TARGET}/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 ${TARGET}/dev
|
|
${MAKEDEV} generic
|
|
${MAKEDEV} std
|
|
|
|
fi # -n ${MAKEDEV}
|
|
|
|
#
|
|
# Log our finish
|
|
#
|
|
logMessage Script $0 finished
|