Hi, Dave:
I need to replace my package scu(driver/storage/scu) with the lastest
using the DC, and currently my dc_ai_x86.xml and the custom script is in
the attachment, The key error point is "Unable to install
pkg://solaris/scu", my step is that i create a local IPS server with
"/usr/lib/pkg.depotd -d /root/nightly/repo.redist/ -p 10000" and it
contain the lastest package, and then i run "/usr/bin/distro_const build
-v /root/dc_ai_x86.xml". I set a custom script to replace the package
with my own but it failed, can you help me to figure out why it fail?
The output error is
2011-05-16 13:17:29,012 InstallationLogger.custom-script INFO ===
Executing Custom Script Checkpoint ===
2011-05-16 13:17:29,012 InstallationLogger.custom-script INFO Custom
Script provided is: '/export/home/scu_script.sh {PKG_IMAGE_PATH} scu'
2011-05-16 13:17:29,012 InstallationLogger.custom-script INFO Custom
Script to run is: '/export/home/scu_script.sh
/export/home/dc/ai/build_data/pkg_image scu'
2011-05-16 13:17:29,013 InstallationLogger.custom-script DEBUG
Executing: /export/home/scu_script.sh /export/home/dc/ai/build_data/pkg_image
scu
2011-05-16 13:17:29,712 InstallationLogger.custom-script DEBUG
/usr/bin/pkg -R /export/home/dc/ai/build_data/pkg_image uninstall scu
2011-05-16 13:17:30,161 InstallationLogger.custom-script ERROR pkg: The
image cannot be modified as it is currently in use by another package client:
pkg on glasspaper.cn, pid 1257.
2011-05-16 13:17:30,202 InstallationLogger.custom-script ERROR
/export/home/scu_script.sh: Unable to install pkg://solaris/scu
2011-05-16 13:17:30,254 InstallationLogger ERROR Error occurred during
execution of 'custom-script' checkpoint.
Thanks,
Xun
#!/bin/ksh
#
#
# Name:
# scu_pkg
#
# Description:
# This script will build an image using my test package
# from my local repository.
#
# Args:
#
# These Arguments are passed in by default from the DC.
#
# PKG_IMG_PATH: Package image area
# TEST_PKG: Package to replace with one from the test repo
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [ "$#" != "2" ] ; then
print -u2 "Usage: $0: Requires 2 args:"
print -u2 " pkg_image area, pkg_name,"
exit 1
fi
PKG_IMG_PATH=$1
if [ ! -d $PKG_IMG_PATH ] ; then
print -u2 "$0: Image package area $PKG_IMG_PATH is not valid"
exit 1
fi
PKGCMD="/usr/bin/pkg"
#The test packages are passed in as arguments to this finalizer script
#You would have specified the argument like this in the finalizer section
#to pass in the argument
#
#
# <finalizer>
# <script name="/my/update_my_pkg_test">
# <checkpoint name="update-pkg" message= \
# <argslist>
# "SUNWcdrw"
# </argslist>
# </script>
# </finalizer>
#
TEST_PKG=$2
# Assume that my test package resides in
#a repository running on port 10000 of the localhost.
# Specify alternate repository URL
add_url="http://localhost:10000"
# Specify alternate repository authority
add_auth="solaris"
# Check if authority is already set in the package image area, if not,
# add it in
added_authority=0
${PKGCMD} -R $PKG_IMG_PATH authority $add_auth > /dev/null
if [ $? != 0 ] ; then
${PKGCMD} -R $PKG_IMG_PATH set-authority -O ${add_url} ${add_auth}
if [ $? != "0" ] ; then
print -u2 "$0: Unable to set additional authority"
exit 1
fi
added_authority=1
fi
if [ $? != "0" ] ; then
print -u2 "$0: Unable to set additional authority"
exit 1
fi
# Remove the package that's currently in the package image area.
echo "${PKGCMD} -R $PKG_IMG_PATH uninstall ${TEST_PKG}"
${PKGCMD} -R $PKG_IMG_PATH uninstall ${TEST_PKG} > /dev/null 2& >1
if [ $? != "0" ] ; then
print -u2 "$0: Unable to uninstall ${TEST_PKG}"
fi
# Install the package from test repo
pkg_name="pkg://${add_auth}/${TEST_PKG}"
echo "${PKGCMD} -R $PKG_IMG_PATH install ${pkg_name}"
${PKGCMD} -R $PKG_IMG_PATH install ${pkg_name}
if [ $? != "0" ] ; then
print -u2 "$0: Unable to install ${pkg_name}"
exit 1
fi
# if we have added the additional authority, unset it so it doesn't pollute
what's
# originally there
if [ $added_authority == 1 ] ; then
${PKGCMD} -R $PKG_IMG_PATH unset-authority ${add_auth}
fi
exit 0
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dc SYSTEM "/usr/share/install/dc.dtd">
<!--
CDDL HEADER START
The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions
and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at usr/src/OPENSOLARIS.LICENSE.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]
CDDL HEADER END
Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
XML specification for building an Oracle Solaris installer iso image
-->
<dc>
<!--
add_timestamp controls if the iso/usb should have a timestamp
appended to it. Useful if the intent is to do serial builds and to keep
all the incremental images around
-->
<distro name="Oracle_Solaris_AI_X86" add_timestamp="false">
<!-- Uncomment if http_proxy needs to be set
<distro name="Oracle_Solaris_AI_X86" add_timestamp="false"
http_proxy="http://example.com">
-->
<distro_spec>
<img_params>
<media_im>
<!--
Grub menu modifications to be applied to the image.
Optional attributes that can be specified here are:
title - title for the specialized GRUB entry
Default is to use the first line of /etc/release
default_entry - which entry should be the default entry
timeout - GRUB menu timeout value in seconds
-->
<grub_mods title="SCU install" default_entry="0" timeout="5">
<!--
Grub entries to add to the default grub menu in the image. Each
entry is added sequentially to the menu.lst file in order of
listing.
An optional "position" attribute is the location in the menu.lst
file to insert the entry. If omitted, simply append the entry
to the end of the menu.lst file.
title suffix - text string added to this specific entry title
line - each line element will be added in order specified
-->
<grub_entry position="1">
<title_suffix>SCU_INSTALL</title_suffix>
<line>kernel$ /platform/i86pc/kernel/$ISADIR/unix</line>
<line>module$ /platform/i86pc/$ISADIR/boot_archive</line>
</grub_entry>
</grub_mods>
</media_im>
</img_params>
</distro_spec>
<!--
Target Section: defines zfs build dataset to be used for the build.
Filesystem name should not include the name of the zpool.
-->
<target name="desired">
<logical>
<zpool name="rpool" action="use_existing">
<filesystem name="export/home/dc/ai" action="preserve"/>
</zpool>
</logical>
</target>
<!--
Software section: defines the payload for the transfer checkpoints.
-->
<!--
Sofware node names should match a corresponding Execution node
checkpoint name.
The values of '{PKG_IMAGE_PATH}' and '{BOOT_ARCHIVE}' are replaced by
distro_const during execution with <ZFS Dataset>/build_data/pkg_image and
<ZFS Dataset>/build_data/boot_archive, respectively.
-->
<software name="transfer-ips-install" type="IPS">
<destination>
<image img_root="{PKG_IMAGE_PATH}" action="create">
<img_type completeness="full"/>
<property val="true">flush-content-cache-on-success</property>
</image>
</destination>
<source>
<publisher name="solaris">
<origin name="http://pkg.oracle.com/solaris/release"/>
<!--
If mirrors for this publisher need to be set, specify them here.
-->
<!-- Uncomment before using
<mirror name="mirror.example.com"></mirror>
-->
</publisher>
<!--
If additional publishers need to be set, they can be set here
-->
<!-- Uncomment before using
<publisher name="solaris">
<origin name="http://example.com"></origin>
<mirror name="mirror1.example.com"></mirror>
<mirror name="mirror2.example.com"></mirror>
</publisher>
-->
</source>
<!--
List of packages used to form the installed image
By default the latest build available in the specified IPS repository
is installed. If another build is required, the build number has to be
appended to the 'entire' package in the following form:
<name>pkg:/[email protected]#</name>
-->
<software_data action="install">
<name>pkg:/entire</name>
<name>pkg:/system/install/media/internal</name>
<name>pkg:/system/install/text-install</name>
<name>pkg:/auto_install</name>
</software_data>
<software_data action="uninstall">
<name>pkg:/auto_install</name>
</software_data>
</software>
<!--
The default publisher to be set on the system after it has been installed.
-->
<software name="set-ips-attributes" type="IPS">
<destination>
<image img_root="{PKG_IMAGE_PATH}" action="use_existing"/>
</destination>
<source>
<publisher name="solaris">
<origin name="http://pkg.oracle.com/solaris/release/"/>
<!--
If mirrors for this publisher are desired, they can be set here
-->
<!-- Uncomment before using
<mirror name="mirror.example.com"></mirror>
-->
</publisher>
</source>
</software>
<!--
Items below this line are rarely configured
-->
<!--
This section defines the contents of the boot_archive
-->
<software name="ba-init" type="CPIO">
<destination>
<dir path="{BOOT_ARCHIVE}"/>
</destination>
<source>
<dir path="{PKG_IMAGE_PATH}"/>
</source>
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
href="/usr/share/distro_const/boot_archive_contents_x86.xml"/>
<software_data action="install">
<name>kernel</name>
<name>boot</name>
<name>platform</name>
<name>system</name>
<name>lib</name>
<name>dev</name>
<name>devices</name>
<name>root</name>
<name>jack</name>
<name>etc</name>
<name>var/svc/manifest</name>
<name>var/svc/profile</name>
<name>var/sadm</name>
</software_data>
<software_data action="uninstall">
<name>var/sadm/pkg</name>
</software_data>
</software>
<!--
Execution section: This section lists the checkpoints that are run in
order to create an image. The checkpoints listed below are run in order.
-->
<execution stop_on_error="true">
<checkpoint name="transfer-ips-install"
desc="Transfer pkg contents from IPS"
mod_path="solaris_install/transfer/ips"
checkpoint_class="TransferIPS"/>
<checkpoint name="set-ips-attributes"
desc="Set post-install IPS attributes"
mod_path="solaris_install/transfer/ips"
checkpoint_class="TransferIPS"/>
<checkpoint name="custom-script"
desc="SCU's script"
mod_path="solaris_install/distro_const/checkpoints/custom_script"
checkpoint_class="CustomScript">
<args>/export/home/scu_script.sh {PKG_IMAGE_PATH} scu</args>
</checkpoint>
<checkpoint name="pre-pkg-img-mod"
desc="Pre package image modification"
mod_path="solaris_install/distro_const/checkpoints/pre_pkg_img_mod"
checkpoint_class="AIPrePkgImgMod">
<!--
root user/role password in the image.
-->
<!--
The default hostname for images is 'solaris'. Setting
the hostname here will override the default.
-->
<kwargs>
<arg name="root_password">solaris</arg>
<arg name="is_plaintext">true</arg>
<!-- uncomment before using
<arg name="hostname">hostname</arg>
-->
</kwargs>
</checkpoint>
<checkpoint name="ba-init"
desc="Boot Archive Initialization"
mod_path="solaris_install/transfer/cpio"
checkpoint_class="TransferCPIO"/>
<checkpoint name="ba-config"
desc="Boot Archive Configuration"
mod_path="solaris_install/distro_const/checkpoints/boot_archive_configure"
checkpoint_class="AIBootArchiveConfigure">
</checkpoint>
<checkpoint name="ba-arch"
desc="Boot Archive Archival"
mod_path="solaris_install/distro_const/checkpoints/boot_archive_archive"
checkpoint_class="BootArchiveArchive">
<!--
compression_type/compression_level to be used in compressing the
boot_archive. Valid types are gzip and none.
size_pad increases the amount of free space in the boot_archive
at the expense of available memory on the booted system.
bytes_per_inode is used to control the 'nbpi' used in sizing up
the boot_archive
-->
<kwargs>
<arg name="compression_type">gzip</arg>
<arg name="compression_level">9</arg>
<arg name="size_pad">0</arg>
<arg name="bytes_per_inode">0</arg>
</kwargs>
</checkpoint>
<checkpoint name="grub-setup"
desc="Setup GRUB menu"
mod_path="solaris_install/distro_const/checkpoints/grub_setup"
checkpoint_class="AIGrubSetup">
<kwargs>
<!-- The installadm_entry defines the title for the default
Grub entry used by installadm when unpacking the image for use -->
<arg name="installadm_entry">Text Installer and command line</arg>
</kwargs>
</checkpoint>
<checkpoint name="pkg-img-mod"
desc="Pkg image area modification"
mod_path="solaris_install/distro_const/checkpoints/pkg_img_mod"
checkpoint_class="AIPkgImgMod">
<!--
compression_type controls the compression algorithm to be used in
compressing solaris.zlib and solarismisc.zlib. Valid values are
gzip and lzma
-->
<kwargs>
<arg name="compression_type">lzma</arg>
</kwargs>
</checkpoint>
<checkpoint name="create-iso"
desc="ISO media creation"
mod_path="solaris_install/distro_const/checkpoints/create_iso"
checkpoint_class="CreateISO">
</checkpoint>
<checkpoint name="create-usb"
desc="USB media creation"
mod_path="solaris_install/distro_const/checkpoints/create_usb"
checkpoint_class="CreateUSB">
</checkpoint>
<checkpoint name="ai-publish-package"
desc="Publish pkg(5) repository"
mod_path="solaris_install/distro_const/checkpoints/ai_publish_pkg"
checkpoint_class="AIPublishPackages">
<!--
The following arguments are optional
If not specified the arguments default to:
pkg_name - image/autoinstall@<AI pkg version>
pkg_repo - file://<MEDIA_DIR>/ai_image_repo
prefix - ai-image
Note: See pkg(5) and pkg.depotd(1M) for a
description of these optional arguments
service_name - solaris-%{arch}-%{build}
<kwargs>
<arg name="pkg_name">name</arg>
<arg name="pkg_repo">repo</arg>
<arg name="prefix">prefix</arg>
<arg name="service_name">solaris-%{arch}-%{build}</arg>
</kwargs>
-->
</checkpoint>
</execution>
<!--
SMF service profiles to be applied to the boot_archive.
These profiles are applied in the order they are specified.
-->
<configuration name="pre-pkg-img-mod" type="sysconf"
source="/etc/svc/profile/generic_limited_net.xml">
<validation path="/usr/sbin/svccfg" args="apply -n"/>
</configuration>
<configuration name="pre-pkg-img-mod" type="sysconf"
source="/usr/share/distro_const/profile/generic.xml">
<validation path="/usr/sbin/svccfg" args="apply -n"/>
</configuration>
<configuration name="pre-pkg-img-mod" type="sysconf"
source="/usr/share/distro_const/profile/ai.xml">
<validation path="/usr/sbin/svccfg" args="apply -n"/>
</configuration>
<configuration name="pre-pkg-img-mod" type="sysconf"
source="/etc/svc/profile/ns_files.xml">
<validation path="/usr/sbin/svccfg" args="apply -n"/>
</configuration>
</distro>
</dc>
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss