source: pkgmngt/packInstall.sh.porg@ bea551c

trunk
Last change on this file since bea551c was d3df258, checked in by Pierre Labastie <pierre.labastie@…>, 10 months ago

Adapt packInstall.sh.porg to xdg-utils location

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