1
0
mirror of synced 2026-04-14 23:37:56 +00:00

Use the debian/55-create-dev script as common/55-create-dev

Use it also for gentoo and dapper.

Add a TODO note about stuff which came up during comparing all the
previously existing variants of 55-create-dev.
This commit is contained in:
Axel Beckert
2012-06-06 16:50:09 +02:00
parent a3cc982efe
commit a3d53e78b5
5 changed files with 49 additions and 180 deletions

21
TODO
View File

@@ -191,3 +191,24 @@ Axel's Break-Backwards-Compatibility Wishlist
This would ease tab completion and CLI parameter reusage with "xm
create" and friends.
* Check if we can reduce MAKEDEV invocations in hooks/common/55-create-dev
MAKEDEV std is called in any case. First comment says "Early
termination if we have a couple of common devices present should
speed up installs which use --copy/--tar" and then "We still need
to make sure the basic devices are present" and calls MAKEDEV more
often than otherwise.
Additionally the 55-create-dev for CentOS/Fedora just created
console, zero and null. zero and null are part of "MAKEDEV std",
perhaps can we reduce it to that. console is part of "MAKEDEV
generic".
Additionally the devices hda, sda and tty1 may not necessary in any
case, but instead hvc0 should be created for sure in many
cases. Nothing cares about $serial_device there either.
Current MAKEDEV implementation support more than one device as
parameter. That could reduce the MAKEDEV calls from currently six
to two.

View File

@@ -11,7 +11,6 @@
prefix=$1
#
# Source our common functions
#
@@ -27,13 +26,34 @@ fi
#
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 "${prefix}${MAKEDEV_PATH}" ]; then
MAKEDEV="${prefix}${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 ${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
@@ -42,10 +62,11 @@ fi
#
# Make the device nodes.
#
chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV console'
chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV null'
chroot ${prefix} /bin/sh -c 'cd /dev && ./MAKEDEV zero'
cd ${prefix}/dev
${MAKEDEV} generic
${MAKEDEV} std
fi # -n ${MAKEDEV}
#
# Log our finish

View File

@@ -1,51 +0,0 @@
#!/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
#
# 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
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

1
hooks/dapper/55-create-dev Symbolic link
View File

@@ -0,0 +1 @@
../common/55-create-dev

View File

@@ -1,74 +0,0 @@
#!/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=''
MAKEDEV_PATHS="/sbin/MAKEDEV /dev/MAKEDEV"
for MAKEDEV_PATH in ${MAKEDEV_PATHS}; do
if [ -x "${prefix}${MAKEDEV_PATH}" ]; then
MAKEDEV="${prefix}${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 ${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
fi # -n ${MAKEDEV}
#
# Log our finish
#
logMessage Script $0 finished

1
hooks/debian/55-create-dev Symbolic link
View File

@@ -0,0 +1 @@
../common/55-create-dev

View File

@@ -1,51 +0,0 @@
#!/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
#
# 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
logMessage "Terminating because there appear to be files in /dev already"
exit
fi
#
# Make the device nodes.
#
cd ${prefix}/dev
./MAKEDEV generic
#
# Log our finish
#
logMessage Script $0 finished

1
hooks/gentoo/55-create-dev Symbolic link
View File

@@ -0,0 +1 @@
../common/55-create-dev