solaris software packaging and installation paul foster 14/11/2000

18
Solaris Software Packaging and Installation Paul Foster 14/11/2000

Upload: calvin-townsend

Post on 24-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Solaris Software Packaging and Installation

Paul Foster

14/11/2000

Page 2: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Overview

• Solaris package mechanism & related tools

• Building packages

• Preparing packages for burning on CD

• Sample Package

Page 3: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Seven Steps to a Package on CD

• Build Install Tree

• Build the pkginfo file

• Build the prototype file

• Write your post_install, pre_remove and request scripts

• Build the package

• Build an ISO Image using mkisofs

• Burn a CD using the ISO Image

Page 4: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Solaris Package Process

SourceFiles

pkginfo

prototype

InstallScripts pkgmk Package

mkisofs

ISO Image

CDPackage

pkgprotoBurn CD

Page 5: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Key files in a package

• Key Files– pkginfo : general information about the package

– post_install : runs after files are extracted

– pre_remove : runs prior to software removal

– request : prompts installer for extra information

– prototype : description of files & permissions

3 types of files: – -i installation files (/var/sadm/<pkgname>)

– -f normal files

– -d directories

Page 6: Solaris Software Packaging and Installation Paul Foster 14/11/2000

post_install/pre_remove/request

• Must be Bourne Shell Scripts (/bin/sh)

• Scripts run as root - so use explicit paths (e.g. /bin/rm)

• Make parts conditional ( if HPOV installed then do x,y,z)

• Save modified files in a safe place to aid re-installing

• Modifications to files use sed - especially for delete

• Small progress messages / Detailed error messages

• Request script can be used to read license keys, etc.

• Can place helper scripts in /var/sadm/<pkgname> if desired

• Exit status of 0 indicates no errors

Page 7: Solaris Software Packaging and Installation Paul Foster 14/11/2000

The pkginfo file

• Specifies:

– name of the package (short & long form)

– where to install package (e.g. /opt/pfp)

– revision information

– contact details

Page 8: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Run-time Environment Settings

• Exported variables are the settings from your pkginfo file

BASEDIR=/opt/pfp

CLIENT_BASEDIR=/opt/pfp

DESC=Pauls Sample Package

INSTDATE=Nov 14 2000 08:28

INST_DATADIR=/scratch1/tmp/paul/packaging/installation_package

NAME=pfpEMS

OAMBASE=/usr/sadm/sysadm

PKG=pfp

PKGINST=pfp

PKGSAV=/var/sadm/pkg/pfp/save

PSTAMP=pf200006161700

TZ=Australia/Queensland

VERSION=2.0,REV=2000.6.23.12.00

Page 9: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Making a Prototype(pkgproto <pathname>)

i postinstall

i preremove

i request

i pkginfo

i preremove.sed

d none bin 0755 bin bin

f none bin/flex 0750 bin bin

f none bin/lcc 0751 bin bin

Page 10: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Making a Package(pkgmk -o -d <path> -f prototype -r <prototype

tree>) • Example:

pkgmk -o -d ./installation_tree -f prototype -r ./prototype_tree

– installation_tree : is the target package directory

– prototype : describes how I want things installed

– prototype_tree : is my source files copied from the build area

Page 11: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Installing our package(pkgadd -d <drive> <pkgname>)

bash# /usr/sbin/pkgadd -d /scratch/tmp/paul/packaging/installation_package pfp

Processing package instance <pfp> from </scratch1/tmp/paul/packaging/installation_package>

pfpEMS

(sparc) 2.0,REV=2000.6.23.12.00

CiTR Pty Ltd.

The selected base directory </opt/pfp> must exist before installation is

attempted.

Do you want this directory created now [y,n,?,q] y

Using </opt/pfp> as the package base directory.

## Processing package information.

## Processing system information.

## Verifying disk space requirements.

## Checking for conflicts with packages already installed.

## Checking for setuid/setgid programs.

Page 12: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Installing our Package (cont.)

This package contains scripts which will be executed with super-user

permission during the process of installing this package.

Do you want to continue with the installation of <pfp> [y,n,?] y

Installing pfpEMS as <pfp>

## Installing part 1 of 1.

/opt/pfp/bin/flex

/opt/pfp/bin/lcc

[ verifying class <none> ]

## Executing postinstall script.

Installation of <pfp> was successful.

Page 13: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Information about our package(pkginfo -l [-d <path>] <pkgname>)

bash# /usr/bin/pkginfo -l -d /cdrom/cdrom0 pfp

PKGINST: pfp

NAME: pfpEMS

CATEGORY: system

ARCH: sparc

VERSION: 2.0,REV=2000.6.23.12.00

BASEDIR: /opt/pfp

VENDOR: CiTR Pty Ltd.

DESC: Pauls Sample Package

PSTAMP: pf200006161700

HOTLINE: Please contact your local system administrator.

STATUS: spooled

FILES: 8 spooled pathnames

1 directories

2 executables

5 package information files

1067 blocks used (approx)

Page 14: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Removing our package(pkgrm <pkgname>)

bash# /usr/sbin/pkgrm pfp

The following package is currently installed:

pfp pfpEMS

(sparc) 2.0,REV=2000.6.23.12.00

Do you want to remove this package? y

## Removing installed package instance <pfp>

This package contains scripts which will be executed with super-user

permission during the process of removing this package.

Do you want to continue with the removal of this package [y,n,?,q] y

## Verifying package dependencies.

## Processing package information.

## Executing preremove script.

## Removing pathnames in class <none> (...Some stuff deleted...)

## Updating system information.

Removal of <pfp> was successful.

Page 15: Solaris Software Packaging and Installation Paul Foster 14/11/2000

/var/sadm/pkg

• Your pre_remove script lives here until the package is removed

• pkginfo file determines what gets put in here

• If your package fails to remove cleanly:

– Hand cleanup

– Edit the pre_remove to exit 0 immediately

– Do the pkgrm

Page 16: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Burning the package onto a CD

• mkisofs - builds an ISO9660 file systeme.g.mkisofs -l -o /tmp/cd.iso -a -r -v -A “ems” ./installation_package

• Later versions (1.12) support a -J flag (Joilet support) and tools for verification of ISO images

• Newer versions are downloadable off the net.

• cd.iso suitable for burning onto a CD(Solaris readable by default, PC readable with -J flag)

Page 17: Solaris Software Packaging and Installation Paul Foster 14/11/2000

A Working Example

• For a very simple fully integrated/automated example– Build a prototype tree

– Builds a prototype

– Builds a package

– Builds an ISO file system

– Makefile to perform all tasks in correct order

• See /home/foster/tweek/solaris_package.tar.gz

Page 18: Solaris Software Packaging and Installation Paul Foster 14/11/2000

Other Thoughts

• Alteration of Build Process to Instrument Binaries– Simple code generation of build information

• Release Number, Build Description, Incremental Build No, etc.

• Doesn’t depend on revision control strings embedded in binary (not everyone uses RCS/CVS)

– Manifest of installed binaries (e.g. TP414.1 experience)

• Solaris JumpStart Mechanism– Automated rebuilding of test machine (TV935.3 experience)