source: pkgmngt/packInstall.sh.porg@ 607ef21

ablfs-more legacy trunk
Last change on this file since 607ef21 was a1fcdea1, checked in by Pierre Labastie <pierre@…>, 7 years ago

Node.js is a special case for VERSION

  • Property mode set to 100644
File size: 3.6 KB
RevLine 
[945ccaa]1# $Id:$
2# functions for recording installation of a package and make a tarball,
3# or using fakeroot type commands for install, then packing and installing
4# the package.
5# We only have access to variables PKGDIR and PKG_DEST. Other variables could
6# be set in the environment
7
8extract_version() {
9local VERSION
10
11case $1 in
12 expect*|tcl*|tk*|mozjs*)
13 VERSION=$(echo $1 | sed 's/^[^0-9]*//')
14 ;;
15 vim*|unzip*|zip*)
16 VERSION=$(echo $1 | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/')
17 ;;
18 wireless_tools*|LVM2*)
19 VERSION=$(echo $1 | sed 's/^[^.]*\.//')
20 ;;
21 x264*)
22 VERSION=$(echo $1 | sed 's/.*shot-//')
23 ;;
24 icu*) # No version in PCKGVRS! Use version directly from xml book.
25 # PACK_INSTALL contains the path to this script, which is in the
26 # parent dir of the book.
27 local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent
28 local VERSION1=$(sed -n 's/.*icu-major[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
29 local VERSION2=$(sed -n 's/.*icu-minor[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
30 VERSION=$VERSION1.$VERSION2
31 ;;
[d0e13dd]32 flashplayer*)
33 local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent
34 VERSION=$(sed -n 's/.*flashplayer[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
35 ;;
[945ccaa]36 soundtouch*)
37 local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent
38 VERSION=$(sed -n 's/.*soundtouch[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
39 ;;
40 xf86-video-intel)
41 local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml
42 VERSION=$(sed -n '/<!--/!s/.*-version[^;][^0-9]*\([^"]*\).*/\1/p' $PACKENT)
43 ;;
44 jdk8*)
45 VERSION=1.8.0.$(echo $1 | sed 's/.*u\([0-9]\+\).*/\1/')
46 ;;
47 docbook-xml)
48 VERSION=4.5
49 ;;
50 cacerts*)
51 VERSION=0.1
52 ;;
[a1fcdea1]53 btrfs*|node*)
[d0e13dd]54 VERSION=$(echo $1 | sed 's/^.*v//')
55 ;;
[945ccaa]56 *)
57 VERSION=$(echo $1 | sed 's/^.*[-_]\([0-9]\)/\1/' | sed 's/_/./g')
58 ;;
59# the last sed above is because some package managers do not want a '_'
60# in version.
61esac
62echo ${VERSION,,} # convert to lowercase, in case there is a capital letter
63 # in version
64}
65
66# Export the previous function, since it is used by the others
67export -f extract_version
68# The other "official" functions, wrapInstall and packInstall, are exported
69# by "envars" (in LFS), and the scripts (in BLFS).
70
71wrapInstall() {
72# a bash command is passed as an argument (that may be a compound command).
73# It is executed by this function, after various set-ups...
74
75# Note that PKGDIR is changed to UNPACKDIR
76# and PKG_DEST is changed to PKG_DIR in BLFS tools.
77# The sed for PACKAGE is therefore not needed in BLFS,
78# but it does not hurt, either.
79local PCKGVRS=$(basename $PKGDIR)
80local TGTPKG=$(basename $PKG_DEST)
81local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
82 sed 's/^[0-9]\{1\}-//')
83# Porg converts package names to lowercase anyway, so do the conversion
84# ourselves
85PACKAGE=${PACKAGE,,}
86# version is only accessible from PKGDIR name. Since the format of the
87# name is not normalized, several hacks are necessary (now in function
88# extract_version)...
89VERSION=$(extract_version $PCKGVRS)
90porg -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
91$*
92PORG_EOF
93}
94
95#----------------
96packInstall() {
97
98# With porg, we need only the package name to make the tarball
99local TGTPKG=$(basename $PKG_DEST)
100local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
101 sed 's/^[0-9]\{1\}-//')
102local PCKGVRS=$(basename $PKGDIR)
103# Porg converts package names to lowercase anyway, so do the conversion
104# ourselves
105PACKAGE=${PACKAGE,,}
106# Building the binary package
107porgball ${PACKAGE}
108# The package is in the current directory
109VERSION=$(extract_version $PCKGVRS)
110mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages
111}
Note: See TracBrowser for help on using the repository browser.