Appendix C. Linux source code 229
# If the host has a id_dsa.pub file then append that to the clone's
# authorized_keys file.
#+--------------------------------------------------------------------------+
{
if [ -e /root/.ssh/id_dsa.pub ] ; then
[ ! -d /mnt/clone/root/.ssh/ ] && mkdir -p /mnt/clone/root/.ssh/
echo "# LNXINST" >> /mnt/clone/root/.ssh/authorized_keys
cat /root/.ssh/id_dsa.pub >> /mnt/clone/root/.ssh/authorized_keys
chmod 600 /mnt/clone/root/.ssh/authorized_keys
fi
}
#+--------------------------------------------------------------------------+
function abort
# Exit the script and clean up
#+--------------------------------------------------------------------------+
{
umount_cloned_image
set_offline $CLONE_LINK
set_offline $MASTER_LINK
unlink_one $CLONE_LINK
unlink_one $MASTER_LINK
exit $1
}
#+--------------------------------------------------------------------------+
function get_target_info
# Get the TCP/IP and DNS info for the Linux ID to clone to. This function
# will check both the shared.conf file and the specific target id's conf
# file. If values are still missing then the user will be prompted to
# supply them.
#+--------------------------------------------------------------------------+
{
unset HOSTNAME
[ -f /etc/clone/shared.conf ] && . /etc/clone/shared.conf
[ -f /etc/clone/${cloned_linux_id}.conf ] && . /etc/clone/${cloned_linux_id}.conf
shift # drop the MasterGuestID
shift # drop the CloneGuestID
# If there are still command line arguments then the user must have specified DASD
# on the command line. Unset whatever we have in DASD (from the config files) and
# set DASD equal to the rest of the arguments.
[ $# -gt 0 ] && DASD="$@" && unset DASD_ROOT
# Loop through all of the values that we require and double check that they have
# values. If they don't then we will prompt the user to fill them in.
for v in HOSTNAME IPADDR DNS GATEWAY NETMASK MTU SUBCHANNELS SEARCHDNS NETTYPE DASD
do
if [ -z "$(eval echo \$$v)" ]; then
[ "$PROMPT" != "y" ] && echo "Error: missing required value for $v" && exit 1
[ -z "$first" ] && echo "Please enter $cloned_linux_id's value for: " && first=1
echo -n "$v: "
read in
eval $(echo $v=\"$in\")
export $v
echo "$v=$in" >> /etc/clone/${cloned_linux_id}.conf
Comentarios a estos manuales