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 | *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' |
|
---|
27 | sed 's/_/./g');;
|
---|
28 | # the last sed above is because some package managers do not want a '_'
|
---|
29 | # in version.
|
---|
30 | esac
|
---|
31 |
|
---|
32 | porg -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
|
---|
33 | $*
|
---|
34 | PORG_EOF
|
---|
35 | }
|
---|
36 |
|
---|
37 | #----------------
|
---|
38 | packInstall() {
|
---|
39 |
|
---|
40 | # With porg, we need only the package name to make the tarball
|
---|
41 | local TGTPKG=$(basename $PKG_DEST)
|
---|
42 | local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
|
---|
43 | sed 's/^[0-9]\{1\}-//')
|
---|
44 | local PCKGVRS=$(basename $PKGDIR)
|
---|
45 | # Porg converts package names to lowercase anyway, so do the conversion
|
---|
46 | # ourselves
|
---|
47 | PACKAGE=${PACKAGE,,}
|
---|
48 | case $PCKGVRS in
|
---|
49 | expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;;
|
---|
50 | vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;;
|
---|
51 | tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;;
|
---|
52 | docbook-xml) local VERSION=4.5 ;;
|
---|
53 | *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' |
|
---|
54 | sed 's/_/./g');;
|
---|
55 | # the last sed above is because some package managers do not want a '_'
|
---|
56 | # in version.
|
---|
57 | esac
|
---|
58 | # Building the binary package
|
---|
59 | porgball ${PACKAGE}
|
---|
60 | # The package is in the current directory
|
---|
61 | mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages
|
---|
62 | }
|
---|