[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: build self-contained repository for offline use



Paul Wise <pabs@debian.org> writes:

> On Wed, Jul 6, 2011 at 10:11 AM, Hamish Moffatt wrote:
>
>> Thanks all for the replies. I checked out apt-zip, apt-offline, aptoncd,
>> CDD and apt-clone. None of them really suited my needs, as I want to
>> generate this repository automatically, and want to do a whole class of
>> target systems which will have a baseline set of packages installed.
>>
>> Anyway I've found it's pretty easy to roll my own using python-apt and
>> configuring apt to use alternate locations for the cache, dpkg status
>> file etc. I feed in the dpkg status file from my baseline install, a
>> sources.list and a list of packages I want to be installable, and I can
>> easily download the files. Then use apt-ftparchive to generate the
>> metadata and I'm done.
>
> It would be great if you could publish your script, maybe it could be
> included in some package, like as an example in python-apt?

Not his script but my own. I needed to debootstrap a chroot for
destructive testing a lot and networking at Debconf was flaky (they
fixed it now :) so I created a partial mirror on my laptop of just the
packages needed in a few minutes with reprepro. Full config below.

The filter.sh script has a list of source packages and any binary build
from those sources will be mirrored. You can easily enough filter by
binary package name by altering the flags put into PAT ('-o -w -P %S ').
And you can generate the list from a concatenation of all systems
/var/lib/dpkg/status files quite easily too. This is left as an execise
to the reader.

MfG
        Goswin

----------[ conf/distributions ]----------
Origin: Debian
Label: Debian
Suite: unstable
Codename: sid
Version: 666
Architectures: amd64
Components: main
UDebComponents: 
Description: Upstream Debian Sid amd64
Update: - debian
SignWith: yes
----------[ conf/updates ]----------
Name: debian
Method: http://ftp.ba.debian.org/debian
ListHook: ./filter.sh
VerifyRelease: AED4B06F473041FA
----------[ conf/filter.sh ]----------
#!/bin/sh

SRCS="acl adduser apt aptitude attr base-files base-passwd bash
boost1.42 boost1.46 bsdmainutils bzip2 coreutils cpio cron cwidget dash
db debconf debian-archive-keyring debianutils diffutils dmidecode dpkg
e2fsprogs eglibc findutils gcc-4.4 gcc-4.5 gcc-4.6 gdbm gnupg grep groff
gzip hostname ifupdown insserv iproute iptables iputils isc-dhcp libept
libidn liblocale-gettext-perl libnfnetlink libpipeline libselinux
libsepol libsigc++-2.0 libtext-charwidth-perl libtext-iconv-perl
libtext-wrapi18n-perl libusb logrotate lsb man-db manpages mawk
module-init-tools nano ncurses net-tools netbase netcat newt openssl
openssl098 pam perl popt procps readline6 rsyslog sed sensible-utils
shadow slang2 sqlite3 sysvinit tar tasksel texinfo traceroute tzdata
udev util-linux vim wget xapian-core xz-utils zlib"

PAT="$(for SRC in $SRCS; do printf -- '-o -w -S %s ' $SRC; done | cut
-b4-)"

grep-dctrl $PAT "$1" >"$2"

exit 0


Reply to: