7751 AI image shows warning about /etc/system during boot
5416 GRUB shouldn't track nevada build numbers on official releases
--- a/usr/src/cmd/distro_const/DC-manifest.defval.xml Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/cmd/distro_const/DC-manifest.defval.xml Tue Apr 07 14:41:26 2009 -0700
@@ -18,7 +18,7 @@
CDDL HEADER END
-Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+Copyright 2009 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
-->
@@ -93,6 +93,9 @@
<validator ref="val_is_executable_file"
module="osol_install.distro_const.ValidatorModule.py"
method="is_executable_file"/>
+ <validator ref="val_non_empty_string"
+ module="osol_install.distro_const.ValidatorModule.py"
+ method="is_non_empty_string"/>
</helpers>
<!-- *********** Default setting requests ************ -->
@@ -312,6 +315,11 @@
val_is_executable_file
</validate>
+ <validate nodepath="img_params/grub_menu_modifications/title"
+ missing="ok">
+ val_non_empty_string
+ </validate>
+
<!-- Run val_abspath() on all nodes matching the nodepaths below. -->
<validate group="val_abspath">
"img_params/output_image/bootroot/adjustment/add"
--- a/usr/src/cmd/distro_const/DC-manifest.rng Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/cmd/distro_const/DC-manifest.rng Tue Apr 07 14:41:26 2009 -0700
@@ -288,6 +288,11 @@
<element name="grub_menu_modifications">
<interleave>
<optional>
+ <element name="title">
+ <text/>
+ </element>
+ </optional>
+ <optional>
<element name="default_entry">
<data type="unsignedInt"/>
</element>
--- a/usr/src/cmd/distro_const/DC_defs.py Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/cmd/distro_const/DC_defs.py Tue Apr 07 14:41:26 2009 -0700
@@ -108,6 +108,7 @@
GRUB_DATA = IMG_PARAMS + "/grub_menu_modifications"
GRUB_DEFAULT_ENTRY_NUM = GRUB_DATA + "/default_entry"
GRUB_DEFAULT_TIMEOUT = GRUB_DATA + "/timeout"
+GRUB_TITLE = GRUB_DATA + "/title"
GRUB_ENTRY = GRUB_DATA + "/entry"
GRUB_ENTRY_TITLE_SUFFIX = GRUB_ENTRY + "/title_suffix"
GRUB_ENTRY_POSITION = GRUB_ENTRY + "[title_suffix=\"%s\"]/position"
@@ -140,6 +141,17 @@
BR_FILENAME = "/boot/boot_archive"
DC_LOGGER_NAME="dc_logger"
+# Name of the file containing info about the images.
+# This file will live in the "root" of the image.
+# Since the root of the image will be referenced differently
+# depending on where you are in the Distro Constructor,
+# having a hard coded value for the path is not appropriate here.
+IMAGE_INFO_FILE=".image_info"
+
+# Keywords in the .image_info file used by DC
+IMAGE_INFO_IMAGE_SIZE_KEYWORD="IMAGE_SIZE="
+IMAGE_INFO_GRUB_TITLE_KEYWORD="GRUB_TITLE="
+
# error codes
SUCCESS = 0
GENERAL_ERR = 1
--- a/usr/src/cmd/distro_const/ValidatorModule.py Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/cmd/distro_const/ValidatorModule.py Tue Apr 07 14:41:26 2009 -0700
@@ -152,3 +152,19 @@
dc_log.error("%s either doesn't exist or is " \
"not an executable file" % fname)
return (rv)
+
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ def is_non_empty_string(self, node):
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ # Returns True if the node's string value is not empty.
+ # Returns False otherwise.
+ # Empty string is defined as "" or " "
+ # This function is useful for ensure that <tag></tag> and
+ # <tag> </tag> is not specified.
+ # If " " is acceptable, you should NOT use this function
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ s = node.get_value()
+ if ((s == "") or (s.strip() == "")):
+ return False
+
+ return True
--- a/usr/src/cmd/distro_const/auto_install/ai_x86_image.xml Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/cmd/distro_const/auto_install/ai_x86_image.xml Tue Apr 07 14:41:26 2009 -0700
@@ -333,6 +333,23 @@
Valid types are lzma, gzip, and none.
-->
<live_img_compression type="lzma"/>
+ <!--
+ Grub menu modification. Will use menu.lst if not
+ specified
+ -->
+ <grub_menu_modifications>
+ <!--
+ Specify a title for the grub menu after the
+ image is *installed* using automated installer.
+ If a title for the grub menu is not specified,
+ the first line of /etc/release will be used as
+ the title for the grub menu
+ -->
+ <!--
+ Uncomment before using
+ <title>Special Grub Title Text</title>
+ -->
+ </grub_menu_modifications>
<!--
Indicate whether the IPS index should be generated for
pkg install and uninstall. The default is to not
--- a/usr/src/cmd/distro_const/distro_const.py Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/cmd/distro_const/distro_const.py Tue Apr 07 14:41:26 2009 -0700
@@ -123,8 +123,8 @@
try:
# Need to divide by 1024 because dir_size() return size
# in bytes, and consumers of .image_info expect the
- # size to be in KB.
- image_size = (dir_size(mntpt)) / 1024
+ # size to be in KB. Convert it to an int
+ image_size = int(round((dir_size(mntpt) / 1024), 0))
except:
dc_log.error("Error in getting the size of " + mntpt)
return
@@ -134,8 +134,9 @@
return
try:
- image_file = open(mntpt + "/.image_info", "w+")
- image_file.write("IMAGE_SIZE=" + str(image_size))
+ image_file = open(mntpt + "/" + IMAGE_INFO_FILE, "w+")
+ image_file.write(IMAGE_INFO_IMAGE_SIZE_KEYWORD +
+ str(image_size) + "\n")
image_file.flush()
image_file.close()
except:
--- a/usr/src/cmd/distro_const/slim_cd/all_lang_slim_cd_x86.xml Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/cmd/distro_const/slim_cd/all_lang_slim_cd_x86.xml Tue Apr 07 14:41:26 2009 -0700
@@ -176,6 +176,16 @@
Grub menu modifications. Will use menu.lst if not specified
-->
<grub_menu_modifications>
+ <!--
+ Specify a title for the grub menu.
+ If a title for the grub menu is not specified,
+ the first line of /etc/release will be used as
+ the title for the grub menu
+ -->
+ <!--
+ Uncomment before using
+ <title>Special Grub Title Text</title>
+ -->
<entry>
<title_suffix>with magnifier</title_suffix>
<line>kernel$ /platform/i86pc/kernel/$ISADIR/unix -B assistive_tech=magnifier</line>
--- a/usr/src/cmd/distro_const/slim_cd/slim_cd_x86.xml Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/cmd/distro_const/slim_cd/slim_cd_x86.xml Tue Apr 07 14:41:26 2009 -0700
@@ -170,6 +170,17 @@
Grub menu modifications. Will use menu.lst if not specified
-->
<grub_menu_modifications>
+ <!--
+ Specify a title for the grub menu.
+ If a title for the grub menu is not specified,
+ the first line of /etc/release will be used as
+ the title for the grub menu
+ -->
+ <!--
+ Uncomment before using
+ <title>Special Grub Title Text</title>
+ -->
+
<entry>
<title_suffix>with magnifier</title_suffix>
<line>kernel$ /platform/i86pc/kernel/$ISADIR/unix -B assistive_tech=magnifier</line>
--- a/usr/src/cmd/distro_const/utils/bootroot_archive.py Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/cmd/distro_const/utils/bootroot_archive.py Tue Apr 07 14:41:26 2009 -0700
@@ -293,7 +293,9 @@
# Add 10% to the reported size for overhead, and add padding size,
# if specified. Padding size need to be converted to KB
-bootroot_size = (bootroot_size * 1.1) + (padding * 1024)
+# Also need to make sure that the resulting size is an integer after
+# all the calculations
+bootroot_size = int(round(((bootroot_size * 1.1) + (padding * 1024)), 0))
print "Creating bootroot archive with padded size of %d MB..." % (
(bootroot_size / 1024))
--- a/usr/src/cmd/distro_const/utils/grub_setup.py Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/cmd/distro_const/utils/grub_setup.py Tue Apr 07 14:41:26 2009 -0700
@@ -81,19 +81,45 @@
# get the manifest reader object from the socket
manifest_reader_obj = ManifestRead(MFEST_SOCKET)
-# Get the release from first line of /etc/release in PKG_IMG_PATH
-release_fd = None
release = None
-try:
+
+# if a string is specified in the manifest to be used as the title of the grub
+# menu entries, that string will be used. Otherwise, use the first
+# line of /etc/release as the title
+
+# Get grub title from manifest, if any
+release = get_manifest_value(manifest_reader_obj, GRUB_TITLE)
+if (release != None):
+ # User specified a special grub menu, record that in .image_info
+ img_info_fd = None
try:
- release_fd = open(PKG_IMG_PATH + RELEASE_FILE, "r")
- release = release_fd.readline().strip()
- except Exception, err:
- print >>sys.stderr, sys.argv[0] + ": " + FIND_EXTRACT_ERR_MSG
- raise err
-finally:
- if (release_fd != None):
- release_fd.close()
+ img_info_path = PKG_IMG_PATH + "/" + IMAGE_INFO_FILE
+ try:
+ img_info_fd = open(img_info_path, "a+")
+ img_info_fd.write(IMAGE_INFO_GRUB_TITLE_KEYWORD +
+ release + "\n")
+ except Exception, err:
+ print >>sys.stderr, sys.argv[0] + \
+ "Unable to write to " + img_info_path
+ raise err
+ finally:
+ if (img_info_fd != None):
+ img_info_fd.close()
+else:
+ # grub menu title is not defined in manifest, use the first
+ # line of /etc/release in PKG_IMG_PATH
+ release_fd = None
+ try:
+ try:
+ release_fd = open(PKG_IMG_PATH + RELEASE_FILE, "r")
+ release = release_fd.readline().strip()
+ except Exception, err:
+ print >>sys.stderr, sys.argv[0] + ": " \
+ + FIND_EXTRACT_ERR_MSG
+ raise err
+ finally:
+ if (release_fd != None):
+ release_fd.close()
if ((release == None) or (len(release.strip()) == 0)):
print >>sys.stderr, sys.argv[0] + ": Empty or blank first line in file"
--- a/usr/src/cmd/installadm/installadm-common.sh Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/cmd/installadm/installadm-common.sh Tue Apr 07 14:41:26 2009 -0700
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/ksh
#
# CDDL HEADER START
#
@@ -39,6 +39,8 @@
SPARC_IMAGE="sparc_image"
X86_IMAGE="x86_image"
DOT_RELEASE=".release"
+DOT_IMAGE_INFO=".image_info"
+GRUB_TITLE_KEYWORD="GRUB_TITLE"
CGIBIN_WANBOOTCGI="cgi-bin/wanboot-cgi"
SERVICE_CONFIG_DIR="/var/installadm/services"
AIWEBSERVER="aiwebserver"
@@ -280,27 +282,48 @@
}
#
-# get_relinfo
+# get_grub_title
#
-# Purpose: Get the release info from the <image>/.release file. If the file does not
+# Purpose: Get the line used in the title line of the grub menu.
+# If the <image>/.image_info file contains the GRUB_TITLE line
+# specifying the grub title to be used, the string will be returned.
+# Otherwise, use the first line of the <image>/.release file as the
+# title of the grub menu. If the <image>/.release 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.
+# Returns: String specified with the GRUB_TITLE keyward in <image>/.image_info
+# file. If no GRUB_TITLE is specified or if <image>/.image_info
+# does not exist, the first line of the <image>/.release file will
+# be returned. If <image>/.release file is not found, the value of
+# $VERSION will be returned.
#
-
-#
-get_relinfo()
+get_grub_title()
{
- releasepath=$1/${DOT_RELEASE}
- if [ -f ${releasepath} ]; then
- releaseinfo=`head -1 ${releasepath}`
- else
- releaseinfo=$VERSION
+
+ grub_title=""
+
+ image_info_path=$1/${DOT_IMAGE_INFO}
+ if [ -f ${image_info_path} ] ; then
+ while read line ; do
+ if [[ "${line}" == ~(E)^${GRUB_TITLE_KEYWORD}=.* ]]
+ then
+ grub_title="${line#*=}"
+ fi
+ done < ${image_info_path}
fi
- echo "$releaseinfo"
+
+ if [ "X${grub_title}" == "X" ] ; then
+ releasepath=$1/${DOT_RELEASE}
+ if [ -f ${releasepath} ]; then
+ grub_title=`head -1 ${releasepath}`
+ else
+ grub_title=$VERSION
+ fi
+ fi
+ echo "$grub_title"
}
#
@@ -386,8 +409,8 @@
printf "min_mem64=1536\n" >> ${tmpmenu}
# get release info and strip leading spaces
- relinfo=`get_relinfo ${IMAGE_PATH}`
- title=`echo title ${relinfo} | $SED -e 's/ //g'`
+ grub_title_string=`get_grub_title ${IMAGE_PATH}`
+ title=`echo title ${grub_title_string} | $SED -e 's/ //g'`
printf "${title} \n" >> ${tmpmenu}
printf "\tkernel\$ /${BootLofs}/platform/i86pc/kernel/\$ISADIR/unix -B ${BARGLIST}" >> ${tmpmenu}
--- a/usr/src/cmd/slim-install/svc/live-fs-root Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/cmd/slim-install/svc/live-fs-root Tue Apr 07 14:41:26 2009 -0700
@@ -324,6 +324,17 @@
fi
fi
+ # download the .image_info file for x86
+ if [ "$ISA_INFO" != "sparc" ]; then
+ img_info="$url/.image_info"
+ /usr/bin/wget $img_info -O /tmp/.image_info > \
+ /dev/msglog 2> /dev/msglog
+ if [ $? -ne 0 ]; then
+ echo "FAILED" > /dev/msglog
+ exit $SMF_EXIT_ERR_FATAL
+ fi
+ fi
+
# Lofi mount downloaded archives to /usr and /mnt/misc respectively
#
--- a/usr/src/lib/libict_pymod/ict.py Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/lib/libict_pymod/ict.py Tue Apr 07 14:41:26 2009 -0700
@@ -332,6 +332,16 @@
self.KBD_DEFAULTS_FILE = '/etc/default/kbd'
self.KBD_LAYOUT_FILE = '/usr/share/lib/keytables/type_6/kbd_layouts'
+ # determine whether we are doing AI install or slim install
+ self.LIVECD_INSTALL = False
+ self.AUTO_INSTALL = False
+ if os.access("/.livecd", os.R_OK):
+ _dbg_msg('Determined to be doing Live CD install')
+ self.LIVECD_INSTALL = True
+ elif os.access("/.autoinstall", os.R_OK):
+ _dbg_msg('Determined to be doing Automated Install')
+ self.AUTO_INSTALL = True
+
#take root poolname from mnttab
cmd = 'grep "^[^ ]* ' + BASEDIR + ' " /etc/mnttab | '+\
' nawk \'{print $1}\' | sed \'s,/.*,,\''
@@ -1564,11 +1574,66 @@
return_status = self.set_Solaris_partition_active_x86()
return return_status
+
+ def get_special_grub_entry(self):
+ '''Support function for the fix_grub_entry() function.
+ Determines whether a special string is needed for the grub
+ entry. The special string, if specified, should be
+ in the .image_info file.
+
+ - return the special grub entry if one is found in .image_info.
+ - return None if none is found
+ '''
+
+ if ((not self.LIVECD_INSTALL) and (not self.AUTO_INSTALL)):
+ # Not going to have .image_info file
+ return None
+
+ #
+ # Check whether a specific title should be used for the
+ # grub menu instead of the default one. If a specific
+ # title should be used, the Distribution Constructor
+ # will put the special title in the /.cdrom/.image_info file
+ #
+ grub_title = None
+ img_info_fd = None
+ if (self.LIVECD_INSTALL):
+ img_info_file = "/.cdrom/.image_info"
+ else:
+ img_info_file = "/tmp/.image_info"
+
+ try:
+ try:
+ img_info_fd = open(img_info_file, "r")
+ for line in img_info_fd:
+ if line.startswith("GRUB_TITLE="):
+ l = line.rstrip('\n')
+ t = l.split("=")
+ grub_title = t[1]
+ break
+ except:
+ # Should not get into this situation, but
+ # it is harmless to continue, so, just
+ # log it.
+ prerror("Error in reading " + img_info_file)
+ prerror('Traceback:')
+ prerror(traceback.format_exc())
+ finally:
+ if (img_info_fd != None):
+ img_info_fd.close()
+
+ return grub_title
def fix_grub_entry(self):
- '''ICT - Fix up the grub entry. This is required because bootadm 'assumes'
- Solaris. And, even though /etc/release says OpenSolaris it truncates
- the 'Open' off. Replace this globally.
+ '''ICT - Fix up the grub entry. The grub entry titles gets
+ updated in one of 2 ways. If a special grub title entry
+ is defined when the image is built by the Distribution
+ Constructor. That special title will be used.
+ If no special title is used, replace all occurances
+ of "Solaris" in grub entry titles with "OpenSolaris".
+ This is required because bootadm 'assumes'
+ Solaris. And, even though /etc/release says OpenSolaris
+ it truncates the 'Open' off.
return 0 on success, error code otherwise
'''
_register_task(inspect.currentframe())
@@ -1580,17 +1645,85 @@
return ICT_INVALID_PLATFORM
newgrubmenu = self.GRUBMENU + '.new'
- cmd = '/bin/sed -e \'s/title Solaris/title OpenSolaris/g\' ' +\
- self.GRUBMENU + ' > ' + newgrubmenu
- status = _cmd_status(cmd)
- if status == 0:
- if not _move_in_updated_config_file(newgrubmenu, self.GRUBMENU):
- prerror('Failure. Returning: ICT_FIX_GRUB_ENTRY_FAILED')
+
+ grub_title = self.get_special_grub_entry()
+ if (grub_title != None):
+ #
+ # bootadm creates the grub entries based on /etc/release
+ # except that bootadm uses the string "Solaris"
+ # even though /etc/release shows "OpenSolaris"
+ # So, we will get the first line of /etc/release
+ # and replace the string "OpenSolaris" with "Solaris"
+ # in order to be able to find the appropriate
+ # entries in the grub menu. We want to create
+ # this string because we only want to replace
+ # this string with our special title and preserve
+ # the suffixes in the entry titles, if any.
+ #
+ release_fd = None
+ try:
+ release_fd = open("/etc/release", "r")
+ rline = release_fd.readline().strip()
+ old_title = rline.replace(
+ "OpenSolaris", "Solaris")
+ except Error, (errno, strerror):
+ prerror('Error in reading /etc/release.'
+ + strerror)
+ prerror('Failure. Returning: ' +
+ 'ICT_FIX_GRUB_ENTRY_FAILED')
+ if (release_fd != None):
+ release_fd.close()
return ICT_FIX_GRUB_ENTRY_FAILED
+
+ if (release_fd != None):
+ release_fd.close()
+
+ new_title = grub_title
else:
- prerror('fix grub entry cmd=' + cmd + ' returns ' + str(status))
- prerror('Failure. Returning: ICT_FIX_GRUB_ENTRY_FAILED')
+ # Just need to replace Solaris with OpenSolaris in
+ # the title line
+ old_title = "Solaris"
+ new_title = "OpenSolaris"
+
+ old_grub_fd = None
+ new_grub_fd = None
+ try:
+ old_grub_fd = open(self.GRUBMENU, "r")
+ new_grub_fd = open(newgrubmenu, "w")
+ for line in old_grub_fd:
+ if line.startswith("title " + old_title):
+ # replace part of existing title
+ # with the specified new title
+ newline = line.replace(
+ "title " + old_title,
+ "title " + new_title)
+ new_grub_fd.write(newline)
+ else:
+ new_grub_fd.write(line)
+ except Error, (errno, strerror):
+ prerror('Error updating grub menu.' + strerror)
+ prerror('Failure. Returning: ' +
+ 'ICT_FIX_GRUB_ENTRY_FAILED')
+
+ if (old_grub_fd != None):
+ old_grub_fd.close()
+
+ if (new_grub_fd != None):
+ new_grub_fd.close()
return ICT_FIX_GRUB_ENTRY_FAILED
+
+ if (old_grub_fd != None):
+ old_grub_fd.close()
+
+ if (new_grub_fd != None):
+ new_grub_fd.close()
+
+ if not _move_in_updated_config_file(newgrubmenu,
+ self.GRUBMENU):
+ prerror('Failure. Returning: ' +
+ 'ICT_FIX_GRUB_ENTRY_FAILED')
+ return ICT_FIX_GRUB_ENTRY_FAILED
+
return 0
def create_sparc_boot_menu(self):
--- a/usr/src/lib/libtransfer/transfer_mod.py Tue Apr 07 10:54:00 2009 -0700
+++ b/usr/src/lib/libtransfer/transfer_mod.py Tue Apr 07 14:41:26 2009 -0700
@@ -764,13 +764,18 @@
for line in ih:
(opt, val) = line.split("=")
if opt == "IMAGE_SIZE":
- self.distro_size = int(val)
- else:
- raise TAbort("Unable to read " \
- "IMAGE_SIZE in " + self.image_info,
- TM_E_INVALID_CPIO_ACT_ATTR)
+ # Remove the '\n' character read from
+ # the file, and convert to integer
+ self.distro_size = int(val.rstrip('\n'))
+ break
ih.close()
+ if (self.distro_size == 0):
+ # We should have read in a size by now
+ raise TAbort("Unable to read " \
+ "IMAGE_SIZE in " + self.image_info,
+ TM_E_INVALID_CPIO_ACT_ATTR)
+
try:
os.putenv('TMPDIR', '/tmp')
except: