This repository has been archived on 2024-10-17. You can view files and clone it, but cannot push or open issues or pull requests.
MahiroOS-jhalfs/pkgmngt/packInstall.sh.porg

63 lines
2.3 KiB
Text
Raw Normal View History

# $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 ;;
*) 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 ;;
*) 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
}