source: pkgmngt/packInstall.sh.porg@ 654a56a

new_features
Last change on this file since 654a56a was 2706ad5, checked in by Pierre Labastie <pierre@…>, 8 years ago
  • Update README.PACKAGE_MANAGEMENT for porg
  • Improve (?) README test
  • Make VERSION lowercase in packInstall.sh.porg, since porg will do that anyway
  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[df42c7c]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
[0c5dfcc]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 ;;
[5253014]32 soundtouch*)
33 local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent
34 VERSION=$(sed -n 's/.*soundtouch[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
35 ;;
[0c5dfcc]36 xf86-video-intel)
37 local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml
38 VERSION=$(sed -n '/<!--/!s/.*-version[^;][^0-9]*\([^"]*\).*/\1/p' $PACKENT)
39 ;;
40 jdk8*)
41 VERSION=1.8.0.$(echo $1 | sed 's/.*u\([0-9]\+\).*/\1/')
42 ;;
43 docbook-xml)
44 VERSION=4.5
45 ;;
46 cacerts*)
47 VERSION=0.1
48 ;;
49 *)
50 VERSION=$(echo $1 | sed 's/^.*[-_]\([0-9]\)/\1/' | sed 's/_/./g')
51 ;;
52# the last sed above is because some package managers do not want a '_'
53# in version.
54esac
[2706ad5]55echo ${VERSION,,} # convert to lowercase, in case there is a capital letter
56 # in version
[0c5dfcc]57}
58
59# Export the previous function, since it is used by the others
60export -f extract_version
61# The other "official" functions, wrapInstall and packInstall, are exported
62# by "envars" (in LFS), and the scripts (in BLFS).
63
[df42c7c]64wrapInstall() {
65# a bash command is passed as an argument (that may be a compound command).
66# It is executed by this function, after various set-ups...
67
[0c5dfcc]68# Note that PKGDIR is changed to UNPACKDIR
69# and PKG_DEST is changed to PKG_DIR in BLFS tools.
70# The sed for PACKAGE is therefore not needed in BLFS,
71# but it does not hurt, either.
[df42c7c]72local PCKGVRS=$(basename $PKGDIR)
73local TGTPKG=$(basename $PKG_DEST)
74local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
75 sed 's/^[0-9]\{1\}-//')
[7bbcce3]76# Porg converts package names to lowercase anyway, so do the conversion
77# ourselves
78PACKAGE=${PACKAGE,,}
[df42c7c]79# version is only accessible from PKGDIR name. Since the format of the
[0c5dfcc]80# name is not normalized, several hacks are necessary (now in function
81# extract_version)...
82VERSION=$(extract_version $PCKGVRS)
[df42c7c]83porg -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
84$*
85PORG_EOF
86}
87
88#----------------
89packInstall() {
90
91# With porg, we need only the package name to make the tarball
92local TGTPKG=$(basename $PKG_DEST)
93local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
94 sed 's/^[0-9]\{1\}-//')
95local PCKGVRS=$(basename $PKGDIR)
[7bbcce3]96# Porg converts package names to lowercase anyway, so do the conversion
97# ourselves
98PACKAGE=${PACKAGE,,}
[df42c7c]99# Building the binary package
100porgball ${PACKAGE}
101# The package is in the current directory
[0c5dfcc]102VERSION=$(extract_version $PCKGVRS)
[df42c7c]103mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages
104}
Note: See TracBrowser for help on using the repository browser.