OK, since Alex asked me last Sunday what exactly needs to be done to turn a simple chroot (or even a bloody box) into a binpkg producing environment, here’s a little howto …

First, lets start from a freshly unpacked stage3.

1
2
3
4
5
catalyst/x86 stage3-amd64-hardened # chroot . /bin/bash --login
# Now, make sure you turn on FEATURES=buildpkg
# (and setup anything else you need, like CFLAGS,
# LDFLAGS, whatever)
linux # echo 'FEATURES="buildpkg"' >> /etc/make.conf

With that single change you’re basically nearly finished with setting up the whole thing, the remaining things are just

  1. Making sure the binary packages get to a web-enabled (either ftp or http) box, from where you’re going to fetch the binary packages to their target
  2. Make sure you use binary packages on the target systems by default

But first, we’re gonna need to emerge something within that freshly created build chroot.

1
2
3
4
# Let's emerge some packages
linux # emerge -e world -q
... (some minutes/hours/days later)
linux #

Since we now emerged some things we do have quite a few binary packages, which we are going to need on the target systems in order to avoid individual compile time.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
linux # cd /usr/portage/packages/; ls */*
-rw-r--r-- 1 root root  780125 Oct  9 21:59 All/autoconf-2.61-r1.tbz2
-rw-r--r-- 1 root root   24648 Oct  9 21:32 All/autoconf-wrapper-4-r3.tbz2
-rw-r--r-- 1 root root   24331 Oct  9 21:32 All/automake-wrapper-3-r1.tbz2
-rw-r--r-- 1 root root  270794 Oct  9 22:07 All/baselayout-1.12.9-r2.tbz2
-rw-r--r-- 1 root root  734855 Oct  9 21:41 All/bash-3.2_p17.tbz2
-rw-r--r-- 1 root root 3546966 Oct  9 21:51 All/binutils-2.17-r1.tbz2
-rw-r--r-- 1 root root   23989 Oct  9 21:48 All/binutils-config-1.9-r4.tbz2
-rw-r--r-- 1 root root  536021 Oct  9 21:49 All/bison-2.3.tbz2
-rw-r--r-- 1 root root 1589258 Oct  9 21:36 All/busybox-1.6.1.tbz2
-rw-r--r-- 1 root root  592700 Oct  9 21:36 All/bzip2-1.0.4.tbz2
-rw-r--r-- 1 root root  119105 Oct  9 22:03 All/ca-certificates-20070303-r1.tbz2
-rw-r--r-- 1 root root   50235 Oct  9 21:43 All/com_err-1.39.tbz2
-rw-r--r-- 1 root root 2377785 Oct  9 22:05 All/coreutils-6.9-r1.tbz2
-rw-r--r-- 1 root root  180610 Oct  9 21:37 All/cpio-2.9.tbz2
-rw-r--r-- 1 root root  256863 Oct  9 21:31 All/cracklib-2.8.10.tbz2
-rw-r--r-- 1 root root 2356960 Oct  9 21:56 All/db-4.5.20_p2.tbz2
-rw-r--r-- 1 root root   67253 Oct  9 21:58 All/debianutils-2.17.5.tbz2
-rw-r--r-- 1 root root  327359 Oct  9 21:59 All/diffutils-2.8.7-r2.tbz2
-rw-r--r-- 1 root root  805505 Oct  9 21:52 All/e2fsprogs-1.39-r2.tbz2
-rw-r--r-- 1 root root  199867 Oct  9 21:31 All/expat-2.0.1.tbz2
-rw-r--r-- 1 root root  465529 Oct  9 21:44 All/findutils-4.3.8-r1.tbz2
-rw-r--r-- 1 root root  379065 Oct  9 21:45 All/flex-2.5.33-r2.tbz2
-rw-r--r-- 1 root root  947984 Oct  9 21:47 All/gawk-3.1.5-r3.tbz2
-rw-r--r-- 1 root root   47111 Oct  9 21:32 All/gcc-config-1.3.16.tbz2
-rw-r--r-- 1 root root 2049299 Oct  9 21:39 All/gettext-0.16.1-r1.tbz2
-rw-r--r-- 1 root root   71249 Oct  9 21:31 All/gnuconfig-20070118.tbz2
-rw-r--r-- 1 root root  198718 Oct  9 21:45 All/grep-2.5.1a-r1.tbz2
-rw-r--r-- 1 root root 2770274 Oct  9 22:08 All/groff-1.19.2-r1.tbz2
-rw-r--r-- 1 root root  158291 Oct  9 21:46 All/gzip-1.3.12.tbz2
-rw-r--r-- 1 root root   31423 Oct  9 21:32 All/hashalot-0.3-r2.tbz2
-rw-r--r-- 1 root root   18045 Oct  9 21:49 All/init-0.tbz2
-rw-r--r-- 1 root root   94341 Oct  9 21:46 All/iputils-20060512.tbz2
-rw-r--r-- 1 root root 1123810 Oct  9 21:46 All/kbd-1.12-r8.tbz2
-rw-r--r-- 1 root root  183504 Oct  9 21:41 All/less-406.tbz2
-rw-r--r-- 1 root root   18560 Oct  9 21:31 All/libiconv-0.tbz2
-rw-r--r-- 1 root root   18583 Oct  9 21:31 All/libintl-0.tbz2
-rw-r--r-- 1 root root 1937796 Oct  9 21:58 All/libperl-5.8.8-r1.tbz2
-rw-r--r-- 1 root root  514331 Oct  9 21:40 All/linux-headers-2.6.21.tbz2
-rw-r--r-- 1 root root  248267 Oct  9 21:42 All/m4-1.4.9-r1.tbz2
-rw-r--r-- 1 root root  502032 Oct  9 21:48 All/make-3.81.tbz2
-rw-r--r-- 1 root root  282155 Oct  9 22:08 All/man-1.6e-r3.tbz2
-rw-r--r-- 1 root root 4013627 Oct  9 21:59 All/man-pages-2.64.tbz2
-rw-r--r-- 1 root root   40598 Oct  9 21:58 All/mktemp-1.5.tbz2
-rw-r--r-- 1 root root  360001 Oct  9 22:07 All/module-init-tools-3.2.2-r3.tbz2
-rw-r--r-- 1 root root  473826 Oct  9 21:48 All/nano-2.0.6.tbz2
-rw-r--r-- 1 root root 1371743 Oct  9 21:29 All/ncurses-5.6-r1.tbz2
-rw-r--r-- 1 root root  564916 Oct  9 21:46 All/net-tools-1.60-r12.tbz2
-rw-r--r-- 1 root root 3002432 Oct  9 22:02 All/openssl-0.9.8e-r3.tbz2
-rw-r--r-- 1 root root  730702 Oct  9 22:07 All/pam-0.78-r5.tbz2
-rw-r--r-- 1 root root  128006 Oct  9 21:36 All/patch-2.5.9.tbz2
-rw-r--r-- 1 root root   90402 Oct  9 21:31 All/pax-utils-0.1.15.tbz2
-rw-r--r-- 1 root root   23917 Oct  9 21:59 All/perl-cleaner-1.04.3.tbz2
-rw-r--r-- 1 root root  115201 Oct  9 21:32 All/pkgconfig-0.21-r1.tbz2
-rw-r--r-- 1 root root   88097 Oct  9 21:44 All/popt-1.10.7.tbz2
-rw-r--r-- 1 root root  416062 Oct  9 21:27 All/portage-2.1.3.9.tbz2
-rw-r--r-- 1 root root  262433 Oct  9 21:41 All/procps-3.2.7.tbz2
-rw-r--r-- 1 root root   20749 Oct  9 21:33 All/python-updater-0.2.tbz2
-rw-r--r-- 1 root root 1032660 Oct  9 21:45 All/readline-5.2_p7.tbz2
-rw-r--r-- 1 root root  302340 Oct  9 21:49 All/rsync-2.6.9-r3.tbz2
-rw-r--r-- 1 root root   76862 Oct  9 21:33 All/sandbox-1.2.17.tbz2
-rw-r--r-- 1 root root  221380 Oct  9 21:43 All/sed-4.1.5.tbz2
-rw-r--r-- 1 root root   37273 Oct  9 21:33 All/setarch-1.8.tbz2
-rw-r--r-- 1 root root 1186511 Oct  9 22:09 All/shadow-4.0.18.1-r1.tbz2
-rw-r--r-- 1 root root   60436 Oct  9 21:48 All/ss-1.39.tbz2
-rw-r--r-- 1 root root  136646 Oct  9 21:43 All/sysvinit-2.86-r8.tbz2
-rw-r--r-- 1 root root  819482 Oct  9 21:47 All/tar-1.18-r2.tbz2
-rw-r--r-- 1 root root  149255 Oct  9 21:33 All/tcp-wrappers-7.6-r8.tbz2
-rw-r--r-- 1 root root  836401 Oct  9 21:42 All/texinfo-4.8-r5.tbz2
-rw-r--r-- 1 root root  545686 Oct  9 21:34 All/timezone-data-2007g.tbz2
-rw-r--r-- 1 root root  318901 Oct  9 22:07 All/udev-114.tbz2
-rw-r--r-- 1 root root   33969 Oct  9 21:33 All/unifdef-1.20.tbz2
-rw-r--r-- 1 root root 1356353 Oct  9 21:56 All/util-linux-2.12r-r7.tbz2
-rw-r--r-- 1 root root  514592 Oct  9 22:03 All/wget-1.10.2.tbz2
-rw-r--r-- 1 root root   53049 Oct  9 21:49 All/which-2.16.tbz2
-rw-r--r-- 1 root root  153247 Oct  9 21:31 All/zlib-1.2.3-r1.tbz2
lrwxrwxrwx 1 root root      31 Oct  9 21:59 app-admin/perl-cleaner-1.04.3.tbz2 -> ../All/perl-cleaner-1.04.3.tbz2
lrwxrwxrwx 1 root root      30 Oct  9 21:33 app-admin/python-updater-0.2.tbz2 -> ../All/python-updater-0.2.tbz2
lrwxrwxrwx 1 root root      23 Oct  9 21:36 app-arch/bzip2-1.0.4.tbz2 -> ../All/bzip2-1.0.4.tbz2
lrwxrwxrwx 1 root root      20 Oct  9 21:37 app-arch/cpio-2.9.tbz2 -> ../All/cpio-2.9.tbz2
lrwxrwxrwx 1 root root      23 Oct  9 21:46 app-arch/gzip-1.3.12.tbz2 -> ../All/gzip-1.3.12.tbz2
lrwxrwxrwx 1 root root      23 Oct  9 21:47 app-arch/tar-1.18-r2.tbz2 -> ../All/tar-1.18-r2.tbz2
lrwxrwxrwx 1 root root      27 Oct  9 21:32 app-crypt/hashalot-0.3-r2.tbz2 -> ../All/hashalot-0.3-r2.tbz2
lrwxrwxrwx 1 root root      22 Oct  9 21:48 app-editors/nano-2.0.6.tbz2 -> ../All/nano-2.0.6.tbz2
lrwxrwxrwx 1 root root      39 Oct  9 22:03 app-misc/ca-certificates-20070303-r1.tbz2 -> ../All/ca-certificates-20070303-r1.tbz2
lrwxrwxrwx 1 root root      28 Oct  9 21:31 app-misc/pax-utils-0.1.15.tbz2 -> ../All/pax-utils-0.1.15.tbz2
lrwxrwxrwx 1 root root      24 Oct  9 21:41 app-shells/bash-3.2_p17.tbz2 -> ../All/bash-3.2_p17.tbz2
lrwxrwxrwx 1 root root      23 Oct  9 21:31 dev-libs/expat-2.0.1.tbz2 -> ../All/expat-2.0.1.tbz2
lrwxrwxrwx 1 root root      29 Oct  9 22:02 dev-libs/openssl-0.9.8e-r3.tbz2 -> ../All/openssl-0.9.8e-r3.tbz2
lrwxrwxrwx 1 root root      23 Oct  9 21:44 dev-libs/popt-1.10.7.tbz2 -> ../All/popt-1.10.7.tbz2
lrwxrwxrwx 1 root root      29 Oct  9 21:32 dev-util/pkgconfig-0.21-r1.tbz2 -> ../All/pkgconfig-0.21-r1.tbz2
lrwxrwxrwx 1 root root      24 Oct  9 21:33 dev-util/unifdef-1.20.tbz2 -> ../All/unifdef-1.20.tbz2
lrwxrwxrwx 1 root root      28 Oct  9 21:46 net-misc/iputils-20060512.tbz2 -> ../All/iputils-20060512.tbz2
lrwxrwxrwx 1 root root      26 Oct  9 21:49 net-misc/rsync-2.6.9-r3.tbz2 -> ../All/rsync-2.6.9-r3.tbz2
lrwxrwxrwx 1 root root      23 Oct  9 22:03 net-misc/wget-1.10.2.tbz2 -> ../All/wget-1.10.2.tbz2
lrwxrwxrwx 1 root root      32 Oct  9 22:07 sys-apps/baselayout-1.12.9-r2.tbz2 -> ../All/baselayout-1.12.9-r2.tbz2
lrwxrwxrwx 1 root root      25 Oct  9 21:36 sys-apps/busybox-1.6.1.tbz2 -> ../All/busybox-1.6.1.tbz2
lrwxrwxrwx 1 root root      28 Oct  9 22:05 sys-apps/coreutils-6.9-r1.tbz2 -> ../All/coreutils-6.9-r1.tbz2
lrwxrwxrwx 1 root root      30 Oct  9 21:58 sys-apps/debianutils-2.17.5.tbz2 -> ../All/debianutils-2.17.5.tbz2
lrwxrwxrwx 1 root root      30 Oct  9 21:59 sys-apps/diffutils-2.8.7-r2.tbz2 -> ../All/diffutils-2.8.7-r2.tbz2
lrwxrwxrwx 1 root root      30 Oct  9 21:44 sys-apps/findutils-4.3.8-r1.tbz2 -> ../All/findutils-4.3.8-r1.tbz2
lrwxrwxrwx 1 root root      25 Oct  9 21:47 sys-apps/gawk-3.1.5-r3.tbz2 -> ../All/gawk-3.1.5-r3.tbz2
lrwxrwxrwx 1 root root      26 Oct  9 21:45 sys-apps/grep-2.5.1a-r1.tbz2 -> ../All/grep-2.5.1a-r1.tbz2
lrwxrwxrwx 1 root root      27 Oct  9 22:08 sys-apps/groff-1.19.2-r1.tbz2 -> ../All/groff-1.19.2-r1.tbz2
lrwxrwxrwx 1 root root      23 Oct  9 21:46 sys-apps/kbd-1.12-r8.tbz2 -> ../All/kbd-1.12-r8.tbz2
lrwxrwxrwx 1 root root      20 Oct  9 21:41 sys-apps/less-406.tbz2 -> ../All/less-406.tbz2
lrwxrwxrwx 1 root root      23 Oct  9 22:08 sys-apps/man-1.6e-r3.tbz2 -> ../All/man-1.6e-r3.tbz2
lrwxrwxrwx 1 root root      26 Oct  9 21:59 sys-apps/man-pages-2.64.tbz2 -> ../All/man-pages-2.64.tbz2
lrwxrwxrwx 1 root root      22 Oct  9 21:58 sys-apps/mktemp-1.5.tbz2 -> ../All/mktemp-1.5.tbz2
lrwxrwxrwx 1 root root      38 Oct  9 22:07 sys-apps/module-init-tools-3.2.2-r3.tbz2 -> ../All/module-init-tools-3.2.2-r3.tbz2
lrwxrwxrwx 1 root root      30 Oct  9 21:46 sys-apps/net-tools-1.60-r12.tbz2 -> ../All/net-tools-1.60-r12.tbz2
lrwxrwxrwx 1 root root      27 Oct  9 21:27 sys-apps/portage-2.1.3.9.tbz2 -> ../All/portage-2.1.3.9.tbz2
lrwxrwxrwx 1 root root      26 Oct  9 21:33 sys-apps/sandbox-1.2.17.tbz2 -> ../All/sandbox-1.2.17.tbz2
lrwxrwxrwx 1 root root      21 Oct  9 21:43 sys-apps/sed-4.1.5.tbz2 -> ../All/sed-4.1.5.tbz2
lrwxrwxrwx 1 root root      23 Oct  9 21:33 sys-apps/setarch-1.8.tbz2 -> ../All/setarch-1.8.tbz2
lrwxrwxrwx 1 root root      30 Oct  9 22:09 sys-apps/shadow-4.0.18.1-r1.tbz2 -> ../All/shadow-4.0.18.1-r1.tbz2
lrwxrwxrwx 1 root root      28 Oct  9 21:43 sys-apps/sysvinit-2.86-r8.tbz2 -> ../All/sysvinit-2.86-r8.tbz2
lrwxrwxrwx 1 root root      31 Oct  9 21:33 sys-apps/tcp-wrappers-7.6-r8.tbz2 -> ../All/tcp-wrappers-7.6-r8.tbz2
lrwxrwxrwx 1 root root      26 Oct  9 21:42 sys-apps/texinfo-4.8-r5.tbz2 -> ../All/texinfo-4.8-r5.tbz2
lrwxrwxrwx 1 root root      31 Oct  9 21:56 sys-apps/util-linux-2.12r-r7.tbz2 -> ../All/util-linux-2.12r-r7.tbz2
lrwxrwxrwx 1 root root      22 Oct  9 21:49 sys-apps/which-2.16.tbz2 -> ../All/which-2.16.tbz2
lrwxrwxrwx 1 root root      28 Oct  9 21:59 sys-devel/autoconf-2.61-r1.tbz2 -> ../All/autoconf-2.61-r1.tbz2
lrwxrwxrwx 1 root root      33 Oct  9 21:32 sys-devel/autoconf-wrapper-4-r3.tbz2 -> ../All/autoconf-wrapper-4-r3.tbz2
lrwxrwxrwx 1 root root      33 Oct  9 21:32 sys-devel/automake-wrapper-3-r1.tbz2 -> ../All/automake-wrapper-3-r1.tbz2
lrwxrwxrwx 1 root root      28 Oct  9 21:51 sys-devel/binutils-2.17-r1.tbz2 -> ../All/binutils-2.17-r1.tbz2
lrwxrwxrwx 1 root root      34 Oct  9 21:48 sys-devel/binutils-config-1.9-r4.tbz2 -> ../All/binutils-config-1.9-r4.tbz2
lrwxrwxrwx 1 root root      21 Oct  9 21:49 sys-devel/bison-2.3.tbz2 -> ../All/bison-2.3.tbz2
lrwxrwxrwx 1 root root      26 Oct  9 21:45 sys-devel/flex-2.5.33-r2.tbz2 -> ../All/flex-2.5.33-r2.tbz2
lrwxrwxrwx 1 root root      29 Oct  9 21:32 sys-devel/gcc-config-1.3.16.tbz2 -> ../All/gcc-config-1.3.16.tbz2
lrwxrwxrwx 1 root root      29 Oct  9 21:39 sys-devel/gettext-0.16.1-r1.tbz2 -> ../All/gettext-0.16.1-r1.tbz2
lrwxrwxrwx 1 root root      30 Oct  9 21:31 sys-devel/gnuconfig-20070118.tbz2 -> ../All/gnuconfig-20070118.tbz2
lrwxrwxrwx 1 root root      28 Oct  9 21:58 sys-devel/libperl-5.8.8-r1.tbz2 -> ../All/libperl-5.8.8-r1.tbz2
lrwxrwxrwx 1 root root      23 Oct  9 21:42 sys-devel/m4-1.4.9-r1.tbz2 -> ../All/m4-1.4.9-r1.tbz2
lrwxrwxrwx 1 root root      21 Oct  9 21:48 sys-devel/make-3.81.tbz2 -> ../All/make-3.81.tbz2
lrwxrwxrwx 1 root root      23 Oct  9 21:36 sys-devel/patch-2.5.9.tbz2 -> ../All/patch-2.5.9.tbz2
lrwxrwxrwx 1 root root      29 Oct  9 21:52 sys-fs/e2fsprogs-1.39-r2.tbz2 -> ../All/e2fsprogs-1.39-r2.tbz2
lrwxrwxrwx 1 root root      20 Oct  9 22:07 sys-fs/udev-114.tbz2 -> ../All/udev-114.tbz2
lrwxrwxrwx 1 root root      32 Oct  9 21:40 sys-kernel/linux-headers-2.6.21.tbz2 -> ../All/linux-headers-2.6.21.tbz2
lrwxrwxrwx 1 root root      24 Oct  9 21:43 sys-libs/com_err-1.39.tbz2 -> ../All/com_err-1.39.tbz2
lrwxrwxrwx 1 root root      27 Oct  9 21:31 sys-libs/cracklib-2.8.10.tbz2 -> ../All/cracklib-2.8.10.tbz2
lrwxrwxrwx 1 root root      24 Oct  9 21:56 sys-libs/db-4.5.20_p2.tbz2 -> ../All/db-4.5.20_p2.tbz2
lrwxrwxrwx 1 root root      26 Oct  9 21:29 sys-libs/ncurses-5.6-r1.tbz2 -> ../All/ncurses-5.6-r1.tbz2
lrwxrwxrwx 1 root root      23 Oct  9 22:07 sys-libs/pam-0.78-r5.tbz2 -> ../All/pam-0.78-r5.tbz2
lrwxrwxrwx 1 root root      27 Oct  9 21:45 sys-libs/readline-5.2_p7.tbz2 -> ../All/readline-5.2_p7.tbz2
lrwxrwxrwx 1 root root      19 Oct  9 21:48 sys-libs/ss-1.39.tbz2 -> ../All/ss-1.39.tbz2
lrwxrwxrwx 1 root root      31 Oct  9 21:34 sys-libs/timezone-data-2007g.tbz2 -> ../All/timezone-data-2007g.tbz2
lrwxrwxrwx 1 root root      25 Oct  9 21:31 sys-libs/zlib-1.2.3-r1.tbz2 -> ../All/zlib-1.2.3-r1.tbz2
lrwxrwxrwx 1 root root      24 Oct  9 21:41 sys-process/procps-3.2.7.tbz2 -> ../All/procps-3.2.7.tbz2
lrwxrwxrwx 1 root root      18 Oct  9 21:49 virtual/init-0.tbz2 -> ../All/init-0.tbz2
lrwxrwxrwx 1 root root      22 Oct  9 21:31 virtual/libiconv-0.tbz2 -> ../All/libiconv-0.tbz2
lrwxrwxrwx 1 root root      21 Oct  9 21:31 virtual/libintl-0.tbz2 -> ../All/libintl-0.tbz2

Now, we just need to figure out a way to get the packages to a remote repository. That’s where bashrc, rsync and ssh come into play.

Take a looksie at my bashrc (or at solar’s if you can find it), especially at syncpkg. That’s the actual function doing all the work for us. It’s basically guessing what profile you’re using atm (by reading the info’s on /etc/make.profile ( x86, amd64)), and the uploading it to the remote location given by REPO_HOST, REPO_BASE and REPO_TYPE (either via environment or by /etc/make.conf).

Sure the emerge takes a bit longer (since emerge forks an rsync process via ssh that syncs the just merged binary to our remote repository), but that way you have a nice repository, from which you can install one or 1.000 boxes.