4111 having multiple install services all said "Opensolaris" in grub menu
4553 create-client returning non zero exit code.
4559 create-client: succeeded when invalid mac addr was given.
4819 add/remove/delete-client: getting full usage message
4534 create-service: target directory is created upon failure with non-existent or invalid image.
--- a/usr/src/cmd/distro_const/auto_install/ai_bootroot_configure Tue Dec 02 11:45:20 2008 -0700
+++ b/usr/src/cmd/distro_const/auto_install/ai_bootroot_configure Tue Dec 02 13:45:47 2008 -0700
@@ -40,7 +40,7 @@
# MFEST_SOCKET: Socket needed to get manifest data via ManifestRead object
# (not used)
#
-# PKG_IMG_PATH: Package image area (not used)
+# PKG_IMG_PATH: Package image area
#
# TMP_DIR: Temporary directory to contain the bootroot file (not used)
#
@@ -49,7 +49,7 @@
# MEDIA_DIR: Area where the media is put (not used)
#
# Note: Although finalizer scripts receive at least the five args above, this
-# script uses only BR_BUILD.
+# script uses only PKG_IMG_PATH and BR_BUILD.
#
# Note: This assumes a populated bootroot area exists at BR_BUILD.
#
@@ -65,7 +65,14 @@
# Get commandline args. First 5 are passed to all finalizer scripts.
-# This is the full path to the top o' the bootroot
+PKG_IMG_PATH=$2
+if [ ! -d ${PKG_IMG_PATH} ] ; then
+ echo "PKG_IMG_PATH not set"
+ print -u2 "$0: package image path ${PKG_IMG_PATH} is not valid"
+ exit 1
+fi
+
+# This is the full path to the top of the bootroot
BR_BUILD=$4
if [ ! -d $BR_BUILD ] ; then
print -u2 "$0: bootroot build area $BR_BUILD is invalid."
@@ -86,4 +93,8 @@
ln -s libc.so.1 ../usr/lib
ln -s libgen.so.1 ../usr/lib
ln -s libcurses.so.1 ../usr/lib
+
+# Create the .release file
+cat ${PKG_IMG_PATH}/etc/release > ${PKG_IMG_PATH}/.release
+
exit $?
--- a/usr/src/cmd/installadm/create-client.sh Tue Dec 02 11:45:20 2008 -0700
+++ b/usr/src/cmd/installadm/create-client.sh Tue Dec 02 13:45:47 2008 -0700
@@ -139,10 +139,16 @@
usage ;
fi
+ fnum=`echo "${MAC_ADDR}" | awk 'BEGIN { FS = ":" } { print NF } ' `
+ if [ $fnum != 6 ]; then
+ echo "${myname}: malformed MAC address: $MAC_ADDR"
+ exit 1
+ fi
+
MAC_ADDR=`expr $MAC_ADDR : '\([0-9a-fA-F][0-9a-fA-F]*\:[0-9a-fA-F][0-9a-fA-F]*\:[0-9a-fA-F][0-9a-fA-F]*\:[0-9a-fA-F][0-9a-fA-F]*\:[0-9a-fA-F][0-9a-fA-F]*\:[0-9a-fA-F][0-9a-fA-F]*\)'`
if [ ! "${MAC_ADDR}" ] ; then
- echo "${myname}: mal-formed MAC address: $2"
+ echo "${myname}: malformed MAC address: $2"
exit 1
fi
shift 2;;
@@ -230,23 +236,23 @@
# Verify that IMAGE_PATH is a valid directory
#
if [ ! -d ${IMAGE_PATH} ]; then
- echo "${myname}: Install image ${IMAGE_PATH} does not exist."
+ echo "${myname}: Install image directory ${IMAGE_PATH} does not exist."
exit 1
fi
+# Verify valid image
+#
+if [ ! -f ${IMAGE_PATH}/solaris.zlib ]; then
+ echo "${myname}: ${IMAGE_PATH}/solaris.zlib does not exist. " \
+ "The specified image is not an OpenSolaris image."
+ exit 1
+fi
+
# Append "boot" to IMAGE_PATH provided by user
#
IMAGE_PATH=${IMAGE_PATH}/boot
-# Verify valid image
-#
-if [ ! -f ${IMAGE_PATH}/grub/pxegrub ]; then
- echo "${myname}: ${IMAGE_PATH}/grub/pxegrub does not exist," \
- "invalid boot image"
- exit 1
-fi
-
# Verify that service corresponding to SERVICE_NAME exists
#
${DIRNAME}/setup-service lookup ${SERVICE_NAME} ${INSTALL_TYPE} local
--- a/usr/src/cmd/installadm/delete-client.sh Tue Dec 02 11:45:20 2008 -0700
+++ b/usr/src/cmd/installadm/delete-client.sh Tue Dec 02 13:45:47 2008 -0700
@@ -68,7 +68,7 @@
#
# MAIN - Program
#
-myname=$0
+myname=`basename $0`
ID=`id`
USER=`expr "${ID}" : 'uid=\([^(]*\).*'`
@@ -116,10 +116,16 @@
usage ;
fi
+ fnum=`echo "${MAC_ADDR}" | awk 'BEGIN { FS = ":" } { print NF } ' `
+ if [ $fnum != 6 ]; then
+ echo "${myname}: malformed MAC address: $MAC_ADDR"
+ exit 1
+ fi
+
MAC_ADDR=`expr $MAC_ADDR : '\([0-9a-fA-F][0-9a-fA-F]*\:[0-9a-fA-F][0-9a-fA-F]*\:[0-9a-fA-F][0-9a-fA-F]*\:[0-9a-fA-F][0-9a-fA-F]*\:[0-9a-fA-F][0-9a-fA-F]*\:[0-9a-fA-F][0-9a-fA-F]*\)'`
if [ ! "${MAC_ADDR}" ] ; then
- echo "mal-formed MAC address: $2"
+ echo "${myname}: malformed MAC address: $1"
exit 1
fi
shift 1
--- a/usr/src/cmd/installadm/installadm-common.sh Tue Dec 02 11:45:20 2008 -0700
+++ b/usr/src/cmd/installadm/installadm-common.sh Tue Dec 02 13:45:47 2008 -0700
@@ -101,6 +101,30 @@
}
#
+# get_relinfo
+#
+# Purpose: Get the release info from the <image>/.release file. If the file does not
+# exist, return the value of $VERSION.
+#
+# Arguments:
+# $1 - path to image
+#
+# Returns: release info from <image>/.release file or value of $VERSION.
+#
+
+#
+get_relinfo()
+{
+ releasepath=$1/.release
+ if [ -f ${releasepath} ]; then
+ releaseinfo=`head -1 ${releasepath} | sed -e 's/ //g'`
+ else
+ releaseinfo=$VERSION
+ fi
+ echo "$releaseinfo"
+}
+
+#
# create_menu_lst_file
#
# Purpose : Create the menu.lst file so that the client can get the information
@@ -120,7 +144,9 @@
if [ $? != 0 ]; then
printf "default=0\n" > $Menufile
printf "timeout=30\n" >> $Menufile
- printf "title ${VERSION} ${BUILD}\n" >> $Menufile
+ dir=`dirname "${IMAGE_PATH}"`
+ relinfo=`get_relinfo $dir`
+ printf "title ${relinfo} \n" >> $Menufile
printf "\tkernel\$ /${BootLofs}/platform/i86pc/kernel/\$ISADIR/unix -B ${BARGLIST}" >> $Menufile
@@ -129,7 +155,6 @@
#
printf "install_media=" >> $Menufile
printf "http://${IMAGE_IP}:${HTTP_PORT}" >> $Menufile
- dir=`dirname "${IMAGE_PATH}"`
printf "${dir}" >> $Menufile
printf ",install_boot=" >> $Menufile
printf "http://${IMAGE_IP}:${HTTP_PORT}" >> $Menufile
--- a/usr/src/cmd/installadm/installadm.c Tue Dec 02 11:45:20 2008 -0700
+++ b/usr/src/cmd/installadm/installadm.c Tue Dec 02 13:45:47 2008 -0700
@@ -781,6 +781,7 @@
{
int option;
+ int ret;
char *protocol = NULL;
char *mac_addr = NULL;
char *bootargs = NULL;
@@ -806,7 +807,7 @@
break;
default:
do_opterr(optopt, option, use);
- exit(1);
+ return (INSTALLADM_FAILURE);
}
}
@@ -819,21 +820,32 @@
return (INSTALLADM_FAILURE);
}
- call_script(CREATE_CLIENT_SCRIPT, argc-1, &argv[1]);
+ ret = call_script(CREATE_CLIENT_SCRIPT, argc-1, &argv[1]);
+ if (ret != 0) {
+ return (INSTALLADM_FAILURE);
+ }
+ return (INSTALLADM_SUCCESS);
}
static int
do_delete_client(int argc, char *argv[], const char *use)
{
+ int ret;
+
/*
* There is one required argument, mac_addr of client
*/
if (argc != 2) {
- usage();
+ (void) fprintf(stderr, "%s\n", gettext(use));
+ return (INSTALLADM_FAILURE);
}
- call_script(DELETE_CLIENT_SCRIPT, argc-1, &argv[1]);
+ ret = call_script(DELETE_CLIENT_SCRIPT, argc-1, &argv[1]);
+ if (ret != 0) {
+ return (INSTALLADM_FAILURE);
+ }
+ return (INSTALLADM_SUCCESS);
}
/*
@@ -860,7 +872,7 @@
* Check for valid number of arguments
*/
if (argc != 5) {
- usage();
+ (void) fprintf(stderr, "%s\n", gettext(use));
return (INSTALLADM_FAILURE);
}
@@ -874,7 +886,7 @@
break;
default:
do_opterr(optopt, option, use);
- exit(1);
+ return (INSTALLADM_FAILURE);
}
}
@@ -956,7 +968,7 @@
* Check for valid number of arguments
*/
if (argc != 5 && argc != 7) {
- usage();
+ (void) fprintf(stderr, "%s\n", gettext(use));
return (INSTALLADM_FAILURE);
}
@@ -976,7 +988,7 @@
break;
default:
do_opterr(optopt, option, use);
- exit(1);
+ return (INSTALLADM_FAILURE);
}
}
@@ -1055,6 +1067,7 @@
{
(void) fprintf(stdout, MSG_INSTALLADM_VERSION,
progname, INSTALLADM_VERSION);
+ return (INSTALLADM_SUCCESS);
}
--- a/usr/src/cmd/installadm/setup-image.sh Tue Dec 02 11:45:20 2008 -0700
+++ b/usr/src/cmd/installadm/setup-image.sh Tue Dec 02 13:45:47 2008 -0700
@@ -192,7 +192,11 @@
image_source=$1
target=$2
- check_target $target
+ # Make sure source exists
+ if [ ! -e "$image_source" ]; then
+ print_err "ERROR: The source image does not exist: ${image_source}"
+ cleanup_and_exit 1
+ fi
# Mount if it is iso
if [ -f "$image_source" ]; then
@@ -210,10 +214,12 @@
cleanup_and_exit 1
fi
+ # create target directory, if needed
+ check_target $target
+
#
# Check for space to create image and in /tftpboot
#
-
space_reqd=`du -ks ${src_dir} | ( read size name; echo $size )`
# copy the whole CD to disk except Boot image
if [ $space_reqd -gt $diskavail ]; then