Appendix C. Linux source code 233
{
[ -n "$VERBOSE" ] && echo "Unlinking minidisks ..."
while [ $# -gt 0 ]; do
set_offline 400$#
unlink_one 400$#
[ $? -eq 0 ] && echo "$1 disk unlinked ..."
shift
done
}
#+--------------------------------------------------------------------------+
function ask_are_you_sure
# Ask "Are you sure?" - if not, then exit
#+--------------------------------------------------------------------------+
{
echo ""
echo "This will copy disks from $master_linux_id to $cloned_linux_id"
echo "Host name will be: $HOSTNAME"
echo "IP address will be: $IPADDR"
echo -n "Do you want to continue? (y/n): "
read ans
if [ $ans != "y" ]; then
abort 1
fi
}
#+--------------------------------------------------------------------------+
function check_logged_off
# Verify the user ID exists and is logged off
# Arg1: The user id to query if it is logged on or not
#+--------------------------------------------------------------------------+
{
cp_cmd QUERY $1
case $? in
0) # user ID is logged on or disconnected
echo "$1 user ID must be logged off"
exit 2
;;
3) # user ID does not exist
echo "$1 user ID does not exist"
exit 3
;;
45) # user ID is logged off - this is correct
;;
*) # unexpected
echo "$1 user ID must exist and be logged off"
exit 4
esac
}
#+--------------------------------------------------------------------------+
function modify_cloned_image
# Modify the networking information in appropriate files under /etc
# Regenerate SSH keys in golden image's /etc/ssh/ directory and change root pw
#+--------------------------------------------------------------------------+
{
source_ipaddr=$(grep IPADDR $CLONE_MNT_PT/etc/sysconfig/network-scripts/ifcfg-eth0 \
| awk -F= '{print $2}')
source_hostname=$(grep HOSTNAME $CLONE_MNT_PT/etc/sysconfig/network \
| awk -F= '{print $2}')
Comentarios a estos manuales