2017-04-09 12:29:32 +02:00
|
|
|
# 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
|
|
|
|
|
|
|
|
extract_version() {
|
|
|
|
local VERSION
|
|
|
|
|
|
|
|
case $1 in
|
2018-09-04 12:06:09 +02:00
|
|
|
expect*|tcl*|tk*|mozjs*|lynx*)
|
2017-04-09 12:29:32 +02:00
|
|
|
VERSION=$(echo $1 | sed 's/^[^0-9]*//')
|
|
|
|
;;
|
2019-08-31 14:52:05 +02:00
|
|
|
unzip*|zip*)
|
2017-04-09 12:29:32 +02:00
|
|
|
VERSION=$(echo $1 | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/')
|
|
|
|
;;
|
|
|
|
wireless_tools*|LVM2*)
|
|
|
|
VERSION=$(echo $1 | sed 's/^[^.]*\.//')
|
|
|
|
;;
|
|
|
|
icu*) # No version in PCKGVRS! Use version directly from xml book.
|
2018-01-30 14:53:34 +01:00
|
|
|
# JH_PACK_INSTALL contains the path to this script, which is in the
|
2017-04-09 12:29:32 +02:00
|
|
|
# parent dir of the book.
|
2018-01-30 14:53:34 +01:00
|
|
|
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
2017-04-09 12:29:32 +02:00
|
|
|
local VERSION1=$(sed -n 's/.*icu-major[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
|
|
|
local VERSION2=$(sed -n 's/.*icu-minor[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
|
|
|
VERSION=$VERSION1.$VERSION2
|
|
|
|
;;
|
2017-09-05 10:46:06 +02:00
|
|
|
exiv*)
|
2018-01-30 14:53:34 +01:00
|
|
|
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
2017-09-05 10:46:06 +02:00
|
|
|
VERSION=$(sed -n 's/.*exiv2[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
|
|
|
;;
|
2017-07-07 09:40:42 +02:00
|
|
|
flashplayer*)
|
2018-01-30 14:53:34 +01:00
|
|
|
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
2017-07-07 09:40:42 +02:00
|
|
|
VERSION=$(sed -n 's/.*flashplayer[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
|
|
|
;;
|
2019-06-15 17:26:23 +02:00
|
|
|
pax*)
|
|
|
|
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
|
|
|
VERSION=$(sed -n 's/.*pax[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
|
|
|
;;
|
2018-02-25 09:05:56 +01:00
|
|
|
psutils*)
|
|
|
|
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
|
|
|
VERSION=$(sed -n 's/.*psutils[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
|
|
|
;;
|
2017-04-09 12:29:32 +02:00
|
|
|
soundtouch*)
|
2018-01-30 14:53:34 +01:00
|
|
|
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
2017-04-09 12:29:32 +02:00
|
|
|
VERSION=$(sed -n 's/.*soundtouch[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
|
|
|
;;
|
2018-02-25 09:30:01 +01:00
|
|
|
unrar*)
|
|
|
|
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
|
|
|
VERSION=$(sed -n 's/.*unrar[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
|
|
|
;;
|
2017-08-23 10:45:02 +02:00
|
|
|
xvid*)
|
2018-01-30 14:53:34 +01:00
|
|
|
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
2017-08-23 10:45:02 +02:00
|
|
|
VERSION=$(sed -n 's/.*xvid[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
|
|
|
;;
|
2017-04-09 12:29:32 +02:00
|
|
|
xf86-video-intel)
|
2018-01-30 14:53:34 +01:00
|
|
|
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml
|
2017-04-09 12:29:32 +02:00
|
|
|
VERSION=$(sed -n '/<!--/!s/.*-version[^;][^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
|
|
|
;;
|
|
|
|
jdk8*)
|
|
|
|
VERSION=1.8.0.$(echo $1 | sed 's/.*u\([0-9]\+\).*/\1/')
|
|
|
|
;;
|
|
|
|
docbook-xml)
|
|
|
|
VERSION=4.5
|
|
|
|
;;
|
|
|
|
cacerts*)
|
|
|
|
VERSION=0.1
|
|
|
|
;;
|
2021-10-21 21:24:47 +02:00
|
|
|
btrfs*|node*|pnmixer*|docbook-v*)
|
2017-07-07 09:40:42 +02:00
|
|
|
VERSION=$(echo $1 | sed 's/^.*v//')
|
|
|
|
;;
|
2018-03-10 11:02:26 +01:00
|
|
|
x265*) # can contain vd.d or just d.d: thanks to packagers
|
|
|
|
VERSION=$(echo $1 | sed 's/^.*[v_]//')
|
2018-03-10 11:08:38 +01:00
|
|
|
;;
|
2021-03-09 22:02:19 +01:00
|
|
|
libuv*|Test-MockModule*) # can contain -vd.d or just -d.d
|
2018-03-10 12:04:42 +01:00
|
|
|
VERSION=$(echo $1 | sed 's/^.*[v-]//')
|
|
|
|
;;
|
2021-03-09 22:02:19 +01:00
|
|
|
junit*|inih*) # can contain -rd.d or just -d.d
|
2018-03-19 22:01:06 +01:00
|
|
|
VERSION=$(echo $1 | sed 's/^.*[r-]//')
|
|
|
|
;;
|
2017-04-09 12:29:32 +02:00
|
|
|
*)
|
|
|
|
VERSION=$(echo $1 | sed 's/^.*[-_]\([0-9]\)/\1/' | sed 's/_/./g')
|
|
|
|
;;
|
|
|
|
# the last sed above is because some package managers do not want a '_'
|
|
|
|
# in version.
|
|
|
|
esac
|
|
|
|
echo ${VERSION,,} # convert to lowercase, in case there is a capital letter
|
|
|
|
# in version
|
|
|
|
}
|
|
|
|
|
|
|
|
# Export the previous function, since it is used by the others
|
|
|
|
export -f extract_version
|
|
|
|
# The other "official" functions, wrapInstall and packInstall, are exported
|
|
|
|
# by "envars" (in LFS), and the scripts (in BLFS).
|
|
|
|
|
|
|
|
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...
|
|
|
|
|
2020-12-04 10:30:37 +01:00
|
|
|
# Note that PKGDIR is changed to JH_UNPACKDIR
|
|
|
|
# and PKG_DEST is changed to JH_PKG_DIR in BLFS tools.
|
2017-04-09 12:29:32 +02:00
|
|
|
# The sed for PACKAGE is therefore not needed in BLFS,
|
|
|
|
# but it does not hurt, either.
|
|
|
|
local PCKGVRS=$(basename $PKGDIR)
|
|
|
|
local TGTPKG=$(basename $PKG_DEST)
|
2020-07-06 07:44:22 +02:00
|
|
|
local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3,4\}-//' |
|
2020-07-06 07:38:54 +02:00
|
|
|
sed 's/^[0-9]\{2\}-//')
|
2017-04-09 12:29:32 +02:00
|
|
|
# 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 (now in function
|
|
|
|
# extract_version)...
|
|
|
|
VERSION=$(extract_version $PCKGVRS)
|
2019-08-17 10:30:36 +02:00
|
|
|
porg -+ -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
|
2017-04-09 12:29:32 +02:00
|
|
|
$*
|
|
|
|
PORG_EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
#----------------
|
|
|
|
packInstall() {
|
|
|
|
|
|
|
|
# With porg, we need only the package name to make the tarball
|
|
|
|
local TGTPKG=$(basename $PKG_DEST)
|
2020-07-06 07:44:22 +02:00
|
|
|
local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3,4\}-//' |
|
2020-07-06 07:46:07 +02:00
|
|
|
sed 's/^[0-9]\{2\}-//')
|
2017-04-09 12:29:32 +02:00
|
|
|
local PCKGVRS=$(basename $PKGDIR)
|
|
|
|
# Porg converts package names to lowercase anyway, so do the conversion
|
|
|
|
# ourselves
|
|
|
|
PACKAGE=${PACKAGE,,}
|
|
|
|
# Building the binary package
|
|
|
|
porgball ${PACKAGE}
|
|
|
|
# The package is in the current directory
|
|
|
|
VERSION=$(extract_version $PCKGVRS)
|
|
|
|
mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages
|
|
|
|
}
|