--- old/usr/src/cmd/installadm/create-client.sh	Tue Nov 17 11:24:27 2009
+++ new/usr/src/cmd/installadm/create-client.sh	Tue Nov 17 11:24:26 2009
@@ -93,7 +93,7 @@
 #
 usage () {
 	echo "Usage: $0 [-b <property>=<value>,...]"
-        echo "\t\t-e <macaddr> -t <imagepath> -n <svcname>"
+        echo "\t\t-e <macaddr> -n <svcname> [-t <imagepath>]"
 	
 	exit 1
 }
@@ -176,7 +176,7 @@
 	fi
         if [ ! "$IMAGE_PATH" ]; then
 		echo "${myname}: Invalid image pathname"
-            usage ;
+		usage ;
 	fi
 	shift 2;;
     -f) BOOT_FILE=$2
@@ -200,11 +200,42 @@
     esac
 done
 
-if [ -z "${MAC_ADDR}" -o -z "${IMAGE_PATH}" -o -z "${SERVICE_NAME}" ]; then
+if [ -z "${MAC_ADDR}" -o -z "${SERVICE_NAME}" ]; then
 	echo "${myname}: Missing one or more required options."
 	usage
 fi 
 
+
+# Verify that service corresponding to SERVICE_NAME exists
+#
+# Check the service exists in SMF
+svcprop -p AI${SERVICE_NAME}/image_path \
+    -c svc:/system/install/server:default 1>/dev/null 2>&1
+if [ $? -ne 0 ]; then
+	echo "${myname}: Service does not exist: ${SERVICE_NAME}"
+	exit 1
+fi
+# Check that the service is running
+${DIRNAME}/setup-service lookup ${SERVICE_NAME} ${INSTALL_TYPE} local
+if [ $? -ne 0 ] ; then
+	echo "${myname}: Service does not exist: ${SERVICE_NAME}"
+	exit 1
+fi
+
+
+# Determine IMAGE PATH if not provided
+#
+if [ -z "${IMAGE_PATH}" ]; then
+		# Find IMAGE PATH from SMF
+		IMAGE_PATH="`svcprop -p AI${SERVICE_NAME}/image_path \
+		    -c svc:/system/install/server:default 2>/dev/null`"
+		if [ $? -ne 0 ]; then
+			echo "${myname}: Image-path record for service" \
+			    "${SERVICE_NAME} is missing."
+			exit 1
+		fi
+fi
+
 # If IMAGE_SERVER is passed in, check that it is equal to the local system
 # since we don't yet support a remote system being the image server.
 #
@@ -251,14 +282,6 @@
 	fi
 fi
 
-# Verify that service corresponding to SERVICE_NAME exists
-#
-${DIRNAME}/setup-service lookup ${SERVICE_NAME} ${INSTALL_TYPE} local
-if [ $? -ne 0 ] ; then
-	echo "${myname}: Service does not exist: ${SERVICE_NAME}"
-	exit 1
-fi
-
 
 # Convert the Ethernet address to DHCP "default client-ID" form:
 #    uppercase hex, preceded by the hardware
