DevTech101

DevTech101

Creating pkgadd Software Packages under Solaris

Note: For a how-to crate a Solaris 11/12 PKG and publish to a repo click here
Note: For a how-to publish a Solaris pkg to a Solaris repository click here

Select your software

  • Create a directory in /tmp/sol_pkg, and copy your files and folders to this directory.
  • Create a prototype file
find . -print | pkgproto > prototype

Modify your prototype file and add a pkginfo line and a postinstall line

vi prototype 
 
i pkginfo=./pkginfo
i postinstall=./postinstall 
d none Agent8.1_b2070255 0755 root root
f none Agent8.1_b2070255/Agent8.1_b2070255.tar 0644 root root
f none Agent8.1_b2070255/setupagent.sh 0755 root root
f none Agent8.1_b2070255/devtech_install.sh 0750 root root

Create your pkginfo file

cat pkginfo

PKG="SMCPnet"
NAME="PnetAgent"
ARCH="sparc"
VERSION="8.1_b2070255"
CATEGORY="application"
VENDOR="BMC Pnet Agent."
EMAIL="admin@devtech101.com"
PSTAMP="Eli Kleinman"
BASEDIR="/opt"
CLASSES="none"

Create the script

cat Agent8.1_b2070255/devtech_install.sh

#!/bin/bash
 
cd /opt/Agent8.1_b2070255
echo -e "/opt\n yes\n  y\n n\n n\n y\n" |./setupagent.sh

Create the postinstall script

cat postinstall

 /opt/Agent8.1_b2070255/devtech_install.sh

Create the package

pkgmk -r `pwd`
## Building pkgmap from package prototype file.
## Processing pkginfo file.
## Attempting to volumize 4 entries in pkgmap.
part  1 -- 397636 blocks, 12 entries
## Packaging one part.
/var/spool/pkg/SMCPnet/pkgmap
/var/spool/pkg/SMCPnet/pkginfo
/var/spool/pkg/SMCPnet/reloc/Agent8.1_b2070255/Agent8.1_b2070255.tar
/var/spool/pkg/SMCPnet/reloc/Agent8.1_b2070255/devtech_install.sh
/var/spool/pkg/SMCPnet/reloc/Agent8.1_b2070255/setupagent.sh
/var/spool/pkg/SMCPnet/install/postinstall
## Validating control scripts.
## Packaging complete.

Translate in the a real package

cd /var/spool/pkg
pkgtrans -s `pwd` /tmp/SMCPnet-8.1_b2070255
 
The following packages are available:
  1  SMCPnet     PnetAgent
                 (sparc) 8.1_b2070255
 
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: all
Transferring  package instance

Install the package if you like

pkgadd -d /tmp/SMCPnet-8.1_b2070255
 
The following packages are available:
  1  SMCPnet     PnetAgent
                 (sparc) 8.1_b2070255
 
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: all

Install with Ops Center

To Install with Ops Center you will have to gzip first the package

gzip SMCPnet-8.1_b2070255

Upload the gzip package file to Ops Center

Helpful References

Creating pkgadd Software Packages under Solaris

%d bloggers like this: