[aa283c0] | 1 | # $Id$
|
---|
[945ccaa] | 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 |
|
---|
| 8 | extract_version() {
|
---|
| 9 | local VERSION
|
---|
| 10 |
|
---|
| 11 | case $1 in
|
---|
[3b4399c9] | 12 | expect*|tcl*|tk*|mozjs*|lynx*)
|
---|
[945ccaa] | 13 | VERSION=$(echo $1 | sed 's/^[^0-9]*//')
|
---|
| 14 | ;;
|
---|
[974fe35] | 15 | unzip*|zip*)
|
---|
[945ccaa] | 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.
|
---|
[1fa0dee] | 22 | # JH_PACK_INSTALL contains the path to this script, which is in the
|
---|
[945ccaa] | 23 | # parent dir of the book.
|
---|
[1fa0dee] | 24 | local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
---|
[945ccaa] | 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 | ;;
|
---|
[711b98e] | 29 | exiv*)
|
---|
[1fa0dee] | 30 | local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
---|
[711b98e] | 31 | VERSION=$(sed -n 's/.*exiv2[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
---|
| 32 | ;;
|
---|
[d0e13dd] | 33 | flashplayer*)
|
---|
[1fa0dee] | 34 | local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
---|
[d0e13dd] | 35 | VERSION=$(sed -n 's/.*flashplayer[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
---|
| 36 | ;;
|
---|
[619b313] | 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 | ;;
|
---|
[8fb1daa] | 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 | ;;
|
---|
[945ccaa] | 45 | soundtouch*)
|
---|
[1fa0dee] | 46 | local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
---|
[945ccaa] | 47 | VERSION=$(sed -n 's/.*soundtouch[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
---|
| 48 | ;;
|
---|
[5c69841] | 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 | ;;
|
---|
[e674994] | 53 | xvid*)
|
---|
[1fa0dee] | 54 | local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
|
---|
[e674994] | 55 | VERSION=$(sed -n 's/.*xvid[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
|
---|
| 56 | ;;
|
---|
[945ccaa] | 57 | xf86-video-intel)
|
---|
[1fa0dee] | 58 | local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml
|
---|
[945ccaa] | 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 | ;;
|
---|
[240d928] | 70 | btrfs*|node*|pnmixer*|docbook-v*)
|
---|
[d0e13dd] | 71 | VERSION=$(echo $1 | sed 's/^.*v//')
|
---|
| 72 | ;;
|
---|
[b25dbcf] | 73 | x265*) # can contain vd.d or just d.d: thanks to packagers
|
---|
| 74 | VERSION=$(echo $1 | sed 's/^.*[v_]//')
|
---|
[eb5a32d] | 75 | ;;
|
---|
[82eacf5] | 76 | libuv*|Test-MockModule*) # can contain -vd.d or just -d.d
|
---|
[0d1c9f0] | 77 | VERSION=$(echo $1 | sed 's/^.*[v-]//')
|
---|
| 78 | ;;
|
---|
[82eacf5] | 79 | junit*|inih*) # can contain -rd.d or just -d.d
|
---|
[6747d51] | 80 | VERSION=$(echo $1 | sed 's/^.*[r-]//')
|
---|
| 81 | ;;
|
---|
[945ccaa] | 82 | *)
|
---|
| 83 | VERSION=$(echo $1 | sed 's/^.*[-_]\([0-9]\)/\1/' | sed 's/_/./g')
|
---|
| 84 | ;;
|
---|
| 85 | # the last sed above is because some package managers do not want a '_'
|
---|
| 86 | # in version.
|
---|
| 87 | esac
|
---|
| 88 | echo ${VERSION,,} # convert to lowercase, in case there is a capital letter
|
---|
| 89 | # in version
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | # Export the previous function, since it is used by the others
|
---|
| 93 | export -f extract_version
|
---|
| 94 | # The other "official" functions, wrapInstall and packInstall, are exported
|
---|
| 95 | # by "envars" (in LFS), and the scripts (in BLFS).
|
---|
| 96 |
|
---|
| 97 | wrapInstall() {
|
---|
| 98 | # a bash command is passed as an argument (that may be a compound command).
|
---|
| 99 | # It is executed by this function, after various set-ups...
|
---|
| 100 |
|
---|
[782a77b] | 101 | # Note that PKGDIR is changed to JH_UNPACKDIR
|
---|
| 102 | # and PKG_DEST is changed to JH_PKG_DIR in BLFS tools.
|
---|
[945ccaa] | 103 | # The sed for PACKAGE is therefore not needed in BLFS,
|
---|
| 104 | # but it does not hurt, either.
|
---|
| 105 | local PCKGVRS=$(basename $PKGDIR)
|
---|
| 106 | local TGTPKG=$(basename $PKG_DEST)
|
---|
[89bcb1b] | 107 | local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3,4\}-//' |
|
---|
[3ac3ae1] | 108 | sed 's/^[0-9]\{2\}-//')
|
---|
[945ccaa] | 109 | # Porg converts package names to lowercase anyway, so do the conversion
|
---|
| 110 | # ourselves
|
---|
| 111 | PACKAGE=${PACKAGE,,}
|
---|
| 112 | # version is only accessible from PKGDIR name. Since the format of the
|
---|
| 113 | # name is not normalized, several hacks are necessary (now in function
|
---|
| 114 | # extract_version)...
|
---|
| 115 | VERSION=$(extract_version $PCKGVRS)
|
---|
[0a0b609] | 116 | porg -+ -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
|
---|
[945ccaa] | 117 | $*
|
---|
| 118 | PORG_EOF
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | #----------------
|
---|
| 122 | packInstall() {
|
---|
| 123 |
|
---|
| 124 | # With porg, we need only the package name to make the tarball
|
---|
| 125 | local TGTPKG=$(basename $PKG_DEST)
|
---|
[89bcb1b] | 126 | local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3,4\}-//' |
|
---|
[2f8d952] | 127 | sed 's/^[0-9]\{2\}-//')
|
---|
[945ccaa] | 128 | local PCKGVRS=$(basename $PKGDIR)
|
---|
| 129 | # Porg converts package names to lowercase anyway, so do the conversion
|
---|
| 130 | # ourselves
|
---|
| 131 | PACKAGE=${PACKAGE,,}
|
---|
| 132 | # Building the binary package
|
---|
| 133 | porgball ${PACKAGE}
|
---|
| 134 | # The package is in the current directory
|
---|
| 135 | VERSION=$(extract_version $PCKGVRS)
|
---|
| 136 | mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages
|
---|
| 137 | }
|
---|