13272 Need to add support for customizing default AI client manifest on AI image for VM construction
authorGlenn Lagasse <glenn.lagasse@sun.com>
Tue, 09 Feb 2010 12:45:59 -0800
changeset 725 d1b3f9dad401
parent 723 4c9eb65ee7b6
child 727 3d76804f6900
13272 Need to add support for customizing default AI client manifest on AI image for VM construction
usr/src/cmd/auto-install/svc/manifest-locator
usr/src/cmd/distro_const/auto_install/ai_pre_boot_archive_pkg_image_mod
usr/src/cmd/distro_const/vmc/prepare_ai_image
usr/src/cmd/distro_const/vmc/vmc_image.xml
--- a/usr/src/cmd/auto-install/svc/manifest-locator	Tue Feb 09 09:38:14 2010 -0800
+++ b/usr/src/cmd/auto-install/svc/manifest-locator	Tue Feb 09 12:45:59 2010 -0800
@@ -47,7 +47,9 @@
 # Filename of the located AI manifest
 AI_MANIFEST_FILE=${AI_MANIFESTDIR}/default.xml
 # Location of the default AI manifest
-AI_DEFAULT_MANIFEST=/usr/share/auto_install/default.xml
+# NOTE: VMC also uses this location to store a custom manifest for
+# installation
+AI_DEFAULT_MANIFEST=/.cdrom/auto_install/default.xml
 
 # Service Discovery Engine
 AISD_ENGINE=/usr/bin/ai_sd
--- a/usr/src/cmd/distro_const/auto_install/ai_pre_boot_archive_pkg_image_mod	Tue Feb 09 09:38:14 2010 -0800
+++ b/usr/src/cmd/distro_const/auto_install/ai_pre_boot_archive_pkg_image_mod	Tue Feb 09 12:45:59 2010 -0800
@@ -21,7 +21,7 @@
 #
 
 #
-# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 
@@ -88,6 +88,8 @@
 
 # Create a directory to store auto_install specific files for
 # use on the install server.
+# NOTE: VMC uses this location (and the default.xml manifest contained
+# therein) to be able to customize virtual machine installations.
 AI_DIR=${PKG_IMG_PATH}/auto_install
 $MKDIR -m 755 ${AI_DIR}
 
--- a/usr/src/cmd/distro_const/vmc/prepare_ai_image	Tue Feb 09 09:38:14 2010 -0800
+++ b/usr/src/cmd/distro_const/vmc/prepare_ai_image	Tue Feb 09 12:45:59 2010 -0800
@@ -22,7 +22,7 @@
 #
 
 #
-# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 
@@ -114,6 +114,8 @@
 # Additional arguments passed as arguments to this finalizer script
 #       from the VMC Manifest:
 #	<full path to bootable ai iso> -
+#	<full path to AI client manifest or "default" to use the
+#	default AI client manifest already on the media
 #
 # Output:
 #
@@ -132,8 +134,11 @@
 # Description:
 #
 #	This finalizer script will take as input a path to a
-#	Bootable AI client image. It will modify the GRUB grub/menu.lst
-#	to contain an kernel entry with the flag: "-B auto_shutdown=enable
+#	Bootable AI client image and optionally a path to an AI
+#	client manifest. It will modify the GRUB grub/menu.lst
+#	to contain a kernel entry with the flag: "-B auto_shutdown=enable
+#	and if a client manifest is supplied it will place that
+#	manifest on the media to be used during installation.
 #
 # Returns:
 #	1 on failure
@@ -158,7 +163,7 @@
 #
 # Process command line arguments
 #
-if (( $# != 6 )) ; then
+if (( $# != 7 )) ; then
 	print -u2 "\nWrong number of arguments provided by Distro Constructor."
 	exit 1
 fi
@@ -166,6 +171,7 @@
 typeset -r PKG_IMG_PATH="$2"
 typeset -r TMP_DIR="$3"
 typeset -r ISO_FILE="$6"  # path to bootable ai image
+typeset -r AI_MANIFEST="$7"  # path to ai client manifest or default
 
 #
 # Validate the arguments
@@ -185,6 +191,11 @@
 	exit 1
 fi
 
+if [[ ${AI_MANIFEST} != "default" && ! -f ${AI_MANIFEST} ]] ; then
+	print -u2 "\nAI Client Manifest: ${AI_MANIFEST} is not found"
+	exit 1
+fi
+
 #
 # Confirm file(1) reports the specified file is an ISO
 #
@@ -393,6 +404,17 @@
 	    "\nWarning: unable to identify the volume ID of the original ISO"
 fi
 
+#
+# Replace the default AI Client Manifest (/auto_install/default.xml)
+# with what the user supplied (if default is specified then nothing
+# is replaced).
+#
+if [[ ${AI_MANIFEST} != "default" ]]; then
+	print -u1 "\nReplacing default AI client manifest with user supplied manifest"
+	cp ${AI_MANIFEST} ${TMP_ISO}/auto_install/default.xml
+else
+	print -u1 "\nImage will use default AI client manifest"
+fi
 
 #
 # Recreate the ISO with mkisofs and the correct file permissions.
@@ -415,4 +437,3 @@
 #
 cleanup
 exit 0
-
--- a/usr/src/cmd/distro_const/vmc/vmc_image.xml	Tue Feb 09 09:38:14 2010 -0800
+++ b/usr/src/cmd/distro_const/vmc/vmc_image.xml	Tue Feb 09 12:45:59 2010 -0800
@@ -18,7 +18,7 @@
    
     CDDL HEADER END
    
-    Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+    Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
     Use is subject to license terms.
 
     XML specification for building a Virtual Machine image 
@@ -80,6 +80,15 @@
 					    Path to bootable AI image ISO
 					-->
 						"/export/home/name_of_bootable_ai_image"
+					<!--
+					    What AI client manifest to use for installation.
+					    "default" will use the existing AI
+					    client manifest included on the
+					    AI media.  To use a custom AI
+					    client manifest, provide a path
+					    to your custom manifest
+					-->
+						"default"
 					</argslist>
 				</script>
 				<script name="/usr/share/distro_const/vmc/create_vm">