source: pkgmngt/packInstall.sh.porg@ f9babd0

ablfs-more legacy trunk
Last change on this file since f9babd0 was f9babd0, checked in by Pierre Labastie <pierre.labastie@…>, 4 years ago

packInstall.sh.porg: fixes for inih and libhandy

  • Property mode set to 100644
File size: 4.7 KB
Line 
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*|lynx*)
13 VERSION=$(echo $1 | sed 's/^[^0-9]*//')
14 ;;
15 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 icu*) # No version in PCKGVRS! Use version directly from xml book.
22 # JH_PACK_INSTALL contains the path to this script, which is in the
23 # parent dir of the book.
24 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
25 local VERSION1=$(sed -n 's/.*icu-major[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
26 local VERSION2=$(sed -n 's/.*icu-minor[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
27 VERSION=$VERSION1.$VERSION2
28 ;;
29 exiv*)
30 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
31 VERSION=$(sed -n 's/.*exiv2[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
32 ;;
33 flashplayer*)
34 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
35 VERSION=$(sed -n 's/.*flashplayer[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
36 ;;
37 pax*)
38 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
39 VERSION=$(sed -n 's/.*pax[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
40 ;;
41 psutils*)
42 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
43 VERSION=$(sed -n 's/.*psutils[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
44 ;;
45 soundtouch*)
46 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
47 VERSION=$(sed -n 's/.*soundtouch[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
48 ;;
49 unrar*)
50 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
51 VERSION=$(sed -n 's/.*unrar[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
52 ;;
53 xvid*)
54 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
55 VERSION=$(sed -n 's/.*xvid[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
56 ;;
57 xf86-video-intel)
58 local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml
59 VERSION=$(sed -n '/<!--/!s/.*-version[^;][^0-9]*\([^"]*\).*/\1/p' $PACKENT)
60 ;;
61 jdk8*)
62 VERSION=1.8.0.$(echo $1 | sed 's/.*u\([0-9]\+\).*/\1/')
63 ;;
64 docbook-xml)
65 VERSION=4.5
66 ;;
67 cacerts*)
68 VERSION=0.1
69 ;;
70 inih*)
71 VERSION=$(echo $1 | sed 's/^.*r//')
72 ;;
73 btrfs*|node*|pnmixer*)
74 VERSION=$(echo $1 | sed 's/^.*v//')
75 ;;
76 x265*) # can contain vd.d or just d.d: thanks to packagers
77 VERSION=$(echo $1 | sed 's/^.*[v_]//')
78 ;;
79 libuv*|Test-MockModule*|libhandy*) # can contain -vd.d or just -d.d
80 VERSION=$(echo $1 | sed 's/^.*[v-]//')
81 ;;
82 junit*) # can contain -rd.d or just -d.d
83 VERSION=$(echo $1 | sed 's/^.*[r-]//')
84 ;;
85 *)
86 VERSION=$(echo $1 | sed 's/^.*[-_]\([0-9]\)/\1/' | sed 's/_/./g')
87 ;;
88# the last sed above is because some package managers do not want a '_'
89# in version.
90esac
91echo ${VERSION,,} # convert to lowercase, in case there is a capital letter
92 # in version
93}
94
95# Export the previous function, since it is used by the others
96export -f extract_version
97# The other "official" functions, wrapInstall and packInstall, are exported
98# by "envars" (in LFS), and the scripts (in BLFS).
99
100wrapInstall() {
101# a bash command is passed as an argument (that may be a compound command).
102# It is executed by this function, after various set-ups...
103
104# Note that PKGDIR is changed to JH_UNPACKDIR
105# and PKG_DEST is changed to JH_PKG_DIR in BLFS tools.
106# The sed for PACKAGE is therefore not needed in BLFS,
107# but it does not hurt, either.
108local PCKGVRS=$(basename $PKGDIR)
109local TGTPKG=$(basename $PKG_DEST)
110local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3,4\}-//' |
111 sed 's/^[0-9]\{2\}-//')
112# Porg converts package names to lowercase anyway, so do the conversion
113# ourselves
114PACKAGE=${PACKAGE,,}
115# version is only accessible from PKGDIR name. Since the format of the
116# name is not normalized, several hacks are necessary (now in function
117# extract_version)...
118VERSION=$(extract_version $PCKGVRS)
119porg -+ -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
120$*
121PORG_EOF
122}
123
124#----------------
125packInstall() {
126
127# With porg, we need only the package name to make the tarball
128local TGTPKG=$(basename $PKG_DEST)
129local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3,4\}-//' |
130 sed 's/^[0-9]\{2\}-//')
131local PCKGVRS=$(basename $PKGDIR)
132# Porg converts package names to lowercase anyway, so do the conversion
133# ourselves
134PACKAGE=${PACKAGE,,}
135# Building the binary package
136porgball ${PACKAGE}
137# The package is in the current directory
138VERSION=$(extract_version $PCKGVRS)
139mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages
140}
Note: See TracBrowser for help on using the repository browser.