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 | # version is only accessible from PKGDIR name. Since the format of the
|
---|
17 | # name is not normalized, several hacks are necessary...
|
---|
18 | case $PCKGVRS in
|
---|
19 | expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;;
|
---|
20 | vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;;
|
---|
21 | tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;;
|
---|
22 | docbook-xml) local VERSION=4.5 ;;
|
---|
23 | *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' |
|
---|
24 | sed 's/_/./g');;
|
---|
25 | # the last sed above is because some package managers do not want a '_'
|
---|
26 | # in version.
|
---|
27 | esac
|
---|
28 |
|
---|
29 | porg -lp ${PACKAGE}-${VERSION} sh << PORG_EOF
|
---|
30 | $*
|
---|
31 | PORG_EOF
|
---|
32 | }
|
---|
33 |
|
---|
34 | #----------------
|
---|
35 | packInstall() {
|
---|
36 |
|
---|
37 | # With porg, we need only the package name to make the tarball
|
---|
38 | local TGTPKG=$(basename $PKG_DEST)
|
---|
39 | local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
|
---|
40 | sed 's/^[0-9]\{1\}-//')
|
---|
41 | local PCKGVRS=$(basename $PKGDIR)
|
---|
42 | case $PCKGVRS in
|
---|
43 | expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;;
|
---|
44 | vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;;
|
---|
45 | tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;;
|
---|
46 | docbook-xml) local VERSION=4.5 ;;
|
---|
47 | *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' |
|
---|
48 | sed 's/_/./g');;
|
---|
49 | # the last sed above is because some package managers do not want a '_'
|
---|
50 | # in version.
|
---|
51 | esac
|
---|
52 | # Building the binary package
|
---|
53 | porgball ${PACKAGE}
|
---|
54 | # The package is in the current directory
|
---|
55 | mv -v ${PACKAGE}-${VERSION}.porg* /var/lib/packages
|
---|
56 | }
|
---|