# $Id:$ # functions for recording installation of a package and make a tarball, # or using fakeroot type commands for install, then packing and installing # the package. # We only have access to variables PKGDIR and PKG_DEST. Other variables could # be set in the environment wrapInstall() { # a bash command is passed as an argument (that may be a compound command). # It is executed by this function, after various set-ups... local PCKGVRS=$(basename $PKGDIR) local TGTPKG=$(basename $PKG_DEST) local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' | sed 's/^[0-9]\{1\}-//') # Porg converts package names to lowercase anyway, so do the conversion # ourselves PACKAGE=${PACKAGE,,} # version is only accessible from PKGDIR name. Since the format of the # name is not normalized, several hacks are necessary... case $PCKGVRS in expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;; vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;; tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;; docbook-xml) local VERSION=4.5 ;; cacerts*) local VERSION=0.1 ;; *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' | sed 's/_/./g');; # the last sed above is because some package managers do not want a '_' # in version. esac porg -lp ${PACKAGE}-${VERSION} sh << PORG_EOF $* PORG_EOF } #---------------- packInstall() { # With porg, we need only the package name to make the tarball local TGTPKG=$(basename $PKG_DEST) local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' | sed 's/^[0-9]\{1\}-//') local PCKGVRS=$(basename $PKGDIR) # Porg converts package names to lowercase anyway, so do the conversion # ourselves PACKAGE=${PACKAGE,,} case $PCKGVRS in expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;; vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;; tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;; docbook-xml) local VERSION=4.5 ;; cacerts*) local VERSION=0.1 ;; *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' | sed 's/_/./g');; # the last sed above is because some package managers do not want a '_' # in version. esac # Building the binary package porgball ${PACKAGE} # The package is in the current directory mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages }