1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
# $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
extract_version() {
local VERSION
case $1 in
expect*|tcl*|tk*|mozjs*|lynx*)
VERSION=$(echo $1 | sed 's/^[^0-9]*//')
;;
unzip*|zip*)
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.
# JH_PACK_INSTALL contains the path to this script, which is in the
# parent dir of the book.
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
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
;;
exiv*)
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
VERSION=$(sed -n 's/.*exiv2[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
;;
flashplayer*)
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
VERSION=$(sed -n 's/.*flashplayer[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
;;
pax*)
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
VERSION=$(sed -n 's/.*pax[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
;;
psutils*)
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
VERSION=$(sed -n 's/.*psutils[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
;;
soundtouch*)
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
VERSION=$(sed -n 's/.*soundtouch[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
;;
unrar*)
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
VERSION=$(sed -n 's/.*unrar[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
;;
xvid*)
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
VERSION=$(sed -n 's/.*xvid[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
;;
xf86-video-intel)
local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml
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
;;
btrfs*|node*|pnmixer*|docbook-v*)
VERSION=$(echo $1 | sed 's/^.*v//')
;;
x265*) # can contain vd.d or just d.d: thanks to packagers
VERSION=$(echo $1 | sed 's/^.*[v_]//')
;;
libuv*|Test-MockModule*) # can contain -vd.d or just -d.d
VERSION=$(echo $1 | sed 's/^.*[v-]//')
;;
junit*|inih*) # can contain -rd.d or just -d.d
VERSION=$(echo $1 | sed 's/^.*[r-]//')
;;
*)
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...
# Note that PKGDIR is changed to JH_UNPACKDIR
# and PKG_DEST is changed to JH_PKG_DIR in BLFS tools.
# 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)
local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3,4\}-//' |
sed 's/^[0-9]\{2\}-//')
# 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)
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,4\}-//' |
sed 's/^[0-9]\{2\}-//')
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
}
|