236 The Virtualization Cookbook for Red Hat Enterprise Linux 5.2
}
#+--------------------------------------------------------------------------+
function umount_cloned_image
# Unmount the cloned root filesystem
#+--------------------------------------------------------------------------+
{
/bin/umount $CLONE_MNT_PT >/dev/null 2>&1
return $?
}
#+--------------------------------------------------------------------------+
function check_for_conf
# Check that the configuration file exists for the ID that we are cloning to.
#+--------------------------------------------------------------------------+
{
if [ ! -f /etc/clone/${cloned_linux_id}.conf -a "$PROMPT" != "y" ]; then
echo "Error: /etc/clone/${cloned_linux_id}.conf not found. Exiting"
exit
fi
}
#+--------------------------------------------------------------------------+
function check_for_vmcp
# Check that the vmcp module is loaded and the vmcp binary is installed.
#+--------------------------------------------------------------------------+
{
# Check that vmcp exists and is executable
[ ! -x /sbin/vmcp ] && echo "Error: can't find /sbin/vmcp" && exit
# Load the vmcp kernel module if not already loaded
if ! /sbin/lsmod | grep vmcp > /dev/null 2>&1 ; then
if ! /sbin/modprobe vmcp > /dev/null 2>&1 ; then
echo "Error: unable to load module vmcp, check kernel version"
exit
fi
fi
wait_for_device /dev/vmcp
[ $? -ne 0 ] && echo "Error: timed out waiting for /dev/vmcp" && exit
}
#+--------------------------------------------------------------------------+
function wait_for_device
# Sleep until a certain file exists
# Arg1: The path of the file to sleep on.
#+--------------------------------------------------------------------------+
{
device=$1
for t in $(seq 1 20)
do
[ -e $device ] && return 0
sleep 1
done
return 1
}
#+--------------------------------------------------------------------------+
Komentarze do niniejszej Instrukcji