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