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 | wrapInstall() {
|
---|
9 | # a bash command is passed as an argument (that may be a compound command).
|
---|
10 | # It is executed by this function, after various set-ups...
|
---|
11 |
|
---|
12 | local PCKGVRS=$(basename $PKGDIR)
|
---|
13 | local TGTPKG=$(basename $PKG_DEST)
|
---|
14 | local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
|
---|
15 | sed 's/^[0-9]\{1\}-//')
|
---|
16 | # Porg converts package names to lowercase anyway, so do the conversion
|
---|
17 | # ourselves
|
---|
18 | PACKAGE=${PACKAGE,,}
|
---|
19 | # version is only accessible from PKGDIR name. Since the format of the
|
---|
20 | # name is not normalized, several hacks are necessary...
|
---|
21 | case $PCKGVRS in
|
---|
22 | expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;;
|
---|
23 | vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;;
|
---|
24 | tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;;
|
---|
25 | docbook-xml) local VERSION=4.5 ;;
|
---|
26 | cacerts*) local VERSION=0.1 ;;
|
---|
27 | *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' |
|
---|
28 | sed 's/_/./g');;
|
---|
29 | # the last sed above is because some package managers do not want a '_'
|
---|
30 | # in version.
|
---|
31 | esac
|
---|
32 |
|
---|
33 | porg -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
|
---|
34 | $*
|
---|
35 | PORG_EOF
|
---|
36 | }
|
---|
37 |
|
---|
38 | #----------------
|
---|
39 | packInstall() {
|
---|
40 |
|
---|
41 | # With porg, we need only the package name to make the tarball
|
---|
42 | local TGTPKG=$(basename $PKG_DEST)
|
---|
43 | local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
|
---|
44 | sed 's/^[0-9]\{1\}-//')
|
---|
45 | local PCKGVRS=$(basename $PKGDIR)
|
---|
46 | # Porg converts package names to lowercase anyway, so do the conversion
|
---|
47 | # ourselves
|
---|
48 | PACKAGE=${PACKAGE,,}
|
---|
49 | case $PCKGVRS in
|
---|
50 | expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;;
|
---|
51 | vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;;
|
---|
52 | tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;;
|
---|
53 | docbook-xml) local VERSION=4.5 ;;
|
---|
54 | cacerts*) local VERSION=0.1 ;;
|
---|
55 | *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' |
|
---|
56 | sed 's/_/./g');;
|
---|
57 | # the last sed above is because some package managers do not want a '_'
|
---|
58 | # in version.
|
---|
59 | esac
|
---|
60 | # Building the binary package
|
---|
61 | porgball ${PACKAGE}
|
---|
62 | # The package is in the current directory
|
---|
63 | mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages
|
---|
64 | }
|
---|