Gentoo Archives: gentoo-dev

From: Geert Bevin <gbevin@×××××××.be>
To: gentoo-dev@g.o
Subject: Re: [gentoo-dev] Useful bash script to create Gentoo binary packages after emerge is over
Date: Wed, 21 Nov 2001 03:18:13
Message-Id: 1006334193.4764.8.camel@willow
In Reply to: [gentoo-dev] Useful bash script to create Gentoo binary packages after emerge is over by Terry Chan
1 Great ! I've been waiting for this for a while. Would be good if this or
2 something similar is integrated by default in portage.
3
4 On Wed, 2001-11-21 at 00:48, Terry Chan wrote:
5 > Hi,
6 >
7 > Hopefully other Gentoo users will find this bash script useful. It creates
8 > Gentoo binary packages AFTER the package has already been emerge'd.
9 >
10 > This is useful if you don't always want to emerge with --buildpkg, but you
11 > do want to create the Gentoo package (tbz2) at a later date. This also
12 > gives the sys-admin a chance to modify the config files that are a part
13 > of any given package and then those config file changes will be bundled
14 > up into the resulting binary package.
15 >
16 > Script must be run as ROOT. Invocation is fairly simple. Using prozilla as
17 > an example:
18 >
19 > quickpkg /var/db/pkg/net-www/prozilla-1.3.6/
20 >
21 > Will create /usr/portage/packages/All/prozilla-1.3.6.tbz2
22 >
23 > This binary Gentoo package can then be installed on another Gentoo system
24 > by simplying copy the tbz2 package to the new gentoo box and then using
25 > this command:
26 >
27 > emerge --usepkg /usr/portage/packages/All/prozilla-1.3.6.tbz2
28 >
29 > Terry Chan
30 > ----------
31 > ----
32 >
33
34 > #!/bin/bash
35 > # This script tries to quickly create a gentoo binary package using the
36 > # /var/db/pkg/class-app/app/* files
37 > #
38 > # Example invocation should be something similar to:
39 > # quickpkg /var/db/pkg/net-www/prozilla-1.3.6/
40 > #
41 > # Resulting tbz2 file will be created in /usr/portage/packages/ALL/
42 > #
43 > # Run this script as ROOT
44 > #
45 > # Comments or questions to tchan@××××××××.com
46 > # Terry Chan, 2001, GPL
47 > #
48 > PF=`cat $1/PF`
49 > MYDIR="/tmp/portage/${PF}"
50 > rm -r ${MYDIR}/temp
51 > mkdir -p ${MYDIR}/temp
52 > cp $1/* ${MYDIR}/temp
53 > cut -f 2 -d " " $1/CONTENTS >${MYDIR}/filelist
54 > tar cjvf ${MYDIR}/bin.tar.bz2 --files-from=${MYDIR}/filelist --no-recursion
55 > rm ${MYDIR}/temp/CONTENTS
56 > xpak ${MYDIR}/temp ${MYDIR}/inf.xpak
57 > tbz2tool join ${MYDIR}/bin.tar.bz2 ${MYDIR}/inf.xpak ${MYDIR}/${PF}.tbz2
58 > [ -d /usr/portage/packages/All ] || mkdir -p /usr/portage/packages/All
59 > mv ${MYDIR}/${PF}.tbz2 /usr/portage/packages/All
60 > rm ${MYDIR}/temp/*
61 > rm ${MYDIR}/bin.tar.bz2 ${MYDIR}/inf.xpak ${MYDIR}/filelist
62 >
63 --
64 Geert Bevin
65 the Leaf sprl/bvba
66 "Use what you need" Pierre Theunisstraat 1/47
67 http://www.theleaf.be 1030 Brussels
68 gbevin@×××××××.be Tel & Fax +32 2 241 19 98