pkgadd(8)


NAME
     pkgadd, pkgrm, pkgclean - Manage optional packages

SYNOPSIS
     pkgadd [-x distpkg] name
     pkgrm [-f] name
     pkgclean [-b] name

DESCRIPTION
     These programs manage optional software packages.  Optional  software  is
     installed  in  /opt.   Only  a  few  symlinks  in  /usr/bin, /usr/lib, or
     /usr/man are used to make the package work, no other  mysterious  changes
     are made to the /usr tree.

     Pkgadd adds  a  package  in  /opt  to  the  system.   A  new  package  is
     distributed as a directory tree, or a (compressed) tar file.  It is named
     on the command line with the -x  option.   It  may  be  in  one  of  four
     formats:

          A directory that is or that contains the package.  (You can omit the
          name now if distpkg ends in the package name.)

          A tar file, if the name ends in .tar,  otherwise  a  compressed  tar
          file.

          A device.  It is assumed to be a compressed tar file  on  floppy  or
          tape.

          From standard input if the name is a dash (-).  It is  also  assumed
          to  be  a  compressed  tar file.  See vol(1) for a program to read a
          multivolume file from a device.

     Pkgadd copies or extracts the directory name from distpkg in /opt,  makes
     symlinks  in  /usr to binaries, library files and manual pages, runs make
     if the package has a src directory, runs an installation script to tie up
     a  few  loose  ends,  and starts daemons that will normally be started by
     /etc/rc at boot time.  pkgadd may be rerun (without the -x option) if the
     package did not install properly or if you want to recompile the package.

     Pkgrm undoes pkgadd's actions, removing the symlinks and also the package
     if called with -f.

     Pkgclean removes compiler temporaries and the build tree to free up  disk
     space.   The  binaries  and other files needed to use the package stay in
     place, so that the package keeps working.

     Both pkgadd and pkgrm must be run by bin.



OPTIONS

     -x distpkg
          Either a directory that is or that contains the package, a  file  in
          (compressed)  tar  format  that  contains  the package, or a tape or
          floppy  device  that  contains  the  packages  as  a   (multivolume)
          compressed  tar file.  (Note that this is just a convenience option,
          you can put the package in /opt yourself if you want to.)

     -f   Fully deinstall a package.  After removing the symlinks the  package
          is also removed from /opt.

     -b   Makes pkgclean remove the source tree too, transforming the  package
          into a binary package.  This action is destructive, it may free up a
          lot of diskspace, but the sources  are  lost.   Make  sure  you  can
          retrieve them somehow.

PACKAGE LAYOUT
     The internal layout of a package is free except for the  files  used  for
     installation or removal.  They are:

     /opt/name/etc/symlinks
          This file must exist and  contain  entries  of  two  filenames,  say
          optfile and usrfile, that are used to make links with the call:

               ln -s optfile usrfile

          Both names must be full pathnames allowing one to make symlinks into
          other, earlier installed packages.

     /opt/name/src
          If this directory exists then it will be  cloned  to  the  directory
          /opt/name/build and make install will be called there to compile and
          install the package.  Pkgrm runs make uninstall in the  source  tree
          and  removes  the  build  tree restoring the package to its original
          state.  This means that  files  installed  within  the  package  but
          outside  the  source tree must be removed.  Pkgclean runs make clean
          instead before removing the build tree.  This should leave installed
          files intact.

     /opt/name/etc/install
          If it exists then it is run after the make.

     /opt/name/etc/rc
          If it exists then it is run after install and on reboot  by  /etc/rc
          with the single argument start.  It is run with the argument stop on
          package removal, to kill daemons.



     /opt/name/etc/daily
          If it exists then it is run once per day by /usr/etc/daily.

     /opt/name/etc/uninstall
          If it exists then it is run as the first thing on a removal.

     /opt/name/etc/info
          This file must exist.  It contains one or  more  headers,  an  empty
          line,  and some information that the package writer wants to convey.
          The headers are words followed by a colon, followed by a  parameter.
          Two  headers  are defined as yet, a "Title:" header, that contains a
          one  line  description  to  be  put  in  /usr/lib/packages,  and   a
          "Requires:" header, that is a comma or space separated list of names
          of packages that this package depends on.  These  required  packages
          must be installed before this package is installed, and this package
          must be removed before the packages  it  requires  can  be  removed.
          More  "keyword:"  lines may be invented in the future.  The complete
          info file is shown  to  the  installer  after  installation,  or  by
          pkginfo if called with just one package name.

     /opt/name/{bin,lib,man}
          A package creator is advised to make these directories if needed and
          to  fill  them  with the apropriate files.  Use symlinks from (files
          in) these directories in the symlinks file.  Do  not  make  symlinks
          from  the  build  tree,  because  the build tree may be cleaned out.
          Also do not place manual page files into a manual page tree in /usr,
          because  they  are  not  listed  in  the  whatis  file.   Make a man
          directory, even if it only contains one  file,  and  make  a  single
          symlink from the man directory into /usr/man.

     Most files in a package should be owned by bin, only files that  must  be
     owned  by  some  other id, like set-uid binaries, can be owned by another
     id.  Installation and removal of the package is done as  root,  including
     the install, rc, daily and uninstall scripts.  Compilation and cleanup of
     the source and build directory is done as bin.

FILES

     /usr/lib/packages        List of installed packages.

SEE ALSO
     pkginfo(1), tar(1), compress(1), gzip(1), man(1), vol(1).

BUGS
     This used to be a done by a simple script in its first incantation.  What
     is it about packages that makes things increasingly more complex?




AUTHOR
     Kees J. Bot (kjb@cs.vu.nl)