Guide du constructeur de distribution Oracle Solaris 11 Express

Exemple de script permettant d'ajouter un package SVR4 à une image

Si vous disposez d'un package au format SVR4, vous pouvez le tester dans une image avant de procéder à sa conversion en package IPS. Vous pouvez utiliser un script de finalisation pour ajouter le contenu d'un package SVR4 à l'image. Reportez-vous au script personnalisé suivant et notez les commentaires dans le script expliquant la manière dont le script réalise cette tâche.


Remarque –

Vous devrez modifier ce script pour inclure le chemin de votre package SVR4. Reportez-vous aux commentaires dans le script.



Exemple A–3 Exemple de script permettant l'ajout de packages SVR4


#!/bin/ksh
#
#
# Name:
# add_my_svr4_pkg
#
# Description:
# This script will build an image using an SVR4 package
# located at a user specified file path.
#
# Note:
# The user must modify this script and provide a valid
# path to an SVR4 package in the PKG_PATH variable.
#
# #
# Args:
#
#   5 arguments are passed in by default from the DC.
#
#   MFEST_SOCKET: Socket needed to get manifest data via ManifestRead object (not used)
#   PKG_IMG_PATH: Package image area
#   TMP_DIR: Temporary directory
#   BR_BUILD: Area where boot archive is put together (not used in this example)
#   MEDIA_DIR: Area where the media is put (not used)
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

if [ "$#" != "5" ] ; then
        print -u2 "Usage: $0: Requires 5 args:"

        print -u2 "    Reader socket, pkg_image area, tmp dir,"
        print -u2 "    boot archive build area, media area"
        exit 1
fi

PKG_IMG_PATH=$2
if [ ! -d $PKG_IMG_PATH ] ; then
        print -u2 "$0: Image package area $PKG_IMG_PATH is not valid"
        exit 1
fi

TMP_DIR=$3

#
# Install an SVR4 packages into the package image area
#

#create an admin file for non-interactive pkgadd's

ADMIN_FILE=${TMP_DIR}/admin.$$
cat << \ADMIN_EOF > $ADMIN_FILE
mail=
instance=unique
partial=nocheck
runlevel=nocheck
idepend=nocheck
rdepend=nocheck
space=nocheck
setuid=nocheck
conflict=nocheck
action=nocheck
networktimeout=60
networkretries=3
authentication=quit
keystore=/var/sadm/security
proxy=
basedir=default
ADMIN_EOF

#
# Path to your new packages
#
PKG_PATH=<User-specified path for SVR4 package>

#
# Test package name 
#
SVR4_TEST_PKG=SUNWmy-test

/usr/sbin/pkgadd -n -a ${ADMIN_FILE} -d $PKG_PATH -R ${PKG_IMG_PATH} ${SVR4_TEST_PKG}

if [ $? != "0" ] ; then
        echo "installing package failed"

        exit 1
fi

/bin/rm ${ADMIN_FILE}

exit 0