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