234 The Virtualization Cookbook for Red Hat Enterprise Linux 5.2
source_host=$(echo $source_hostname| awk -F. '{print $1}')
[ ! -d $CLONE_MNT_PT/etc ] && echo "Error: no $CLONE_MNT_PT/etc found" && abort 1
[ -n "$VERBOSE" ] && echo "Modifying networking info under $CLONE_MNT_PT..."
sed -i \
-e "s/$source_ipaddr/$IPADDR/g" \
-e "s/$source_hostname/$HOSTNAME/g" \
-e "s/$source_host/$target_host/g" \
$CLONE_MNT_PT/etc/hosts
sed -i \
-e "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g"\
-e "s/GATEWAY=.*/GATEWAY=$GATEWAY/g"\
$CLONE_MNT_PT/etc/sysconfig/network
sed -i \
-e "s/IPADDR=.*/IPADDR=$IPADDR/g"\
-e "s/MTU=.*/MTU=$MTU/g"\
-e "s/NETMASK=.*/NETMASK=$NETMASK/g"\
-e "s/SUBCHANNELS=.*/SUBCHANNELS=$SUBCHANNELS/g"\
-e "s/NETTYPE=.*/NETTYPE=$NETTYPE/g"\
$CLONE_MNT_PT/etc/sysconfig/network-scripts/ifcfg-eth0
# Modify MACADDR/HWADDR if specified (optional)
[ -n "$MACADDR" ] && sed -i -e "s/MACADDR=.*/MACADDR=$MACADDR/g" \
$CLONE_MNT_PT/etc/sysconfig/network-scripts/ifcfg-eth0
[ -n "$HWADDR" ] && sed -i -e "s/HWADDR=.*/HWADDR=$HWADDR/g" \
$CLONE_MNT_PT/etc/sysconfig/network-scripts/ifcfg-eth0
# Regenerate the SSH keys on the new clone's root filesystem
[ -n "$VERBOSE" ] && echo "Regenerating SSH keys in $CLONE_MNT_PT/etc/ssh/ ..."
rm -f $CLONE_MNT_PT/etc/ssh/ssh_host*
ssh-keygen -t rsa -N "" -q -f $CLONE_MNT_PT/etc/ssh/ssh_host_rsa_key
ssh-keygen -t dsa -N "" -q -f $CLONE_MNT_PT/etc/ssh/ssh_host_dsa_key
ssh-keygen -t rsa1 -N "" -q -f $CLONE_MNT_PT/etc/ssh/ssh_host_key
copy_key
}
#+--------------------------------------------------------------------------+
function set_online
# This will set online the target minidisk.
# Arg1 - Minidisk virtual address to set online
#+--------------------------------------------------------------------------+
{
local target_mdisk=$(echo $1 | tr 'A-Z' 'a-z')
chccwdev -e 0.0.$target_mdisk >/dev/null
rc=$?
if [ $rc != 0 ]; then
echo "Error: chccwdev -e 0.0.$target_mdisk failed with $rc - exiting"
abort 1
fi
local target_dev_node=`cat /proc/dasd/devices | grep "$target_mdisk(ECKD)" | awk '{
print $7 }'`
if [ "$target_dev_node" = "" ]; then
echo "Error: can't find $target_mdisk(ECKD) in /proc/dasd/devices - exiting"
Comentarios a estos manuales