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

[PATCH] optional 'make mirror' with apt



Partly for practice prior to doing anything significant, and partly
because I could use it, I wrote some support into CVS boot-floppies
to mirror necessary files via 'apt' instead of 'rsync'.  It's
wasteful of disk space (all packages appear twice on disk), wasteful
of bandwidth (minimally so, though), slow (copies all the files from
a local apt-cache to the archive each time it's run), and clunky,
but it works well enough to be useful.

I've packaged it as a diff and a tar file.  The tar file should be
untarred in the boot-floppies root directory, either before or
after applying the diff.  Instructions for use are inside the
tar file, in README-mirror_apt.

Open questions: given the extent to which boot-floppies knows
about sections or anything like that (practically zero), is it
really worth using apt-move (of which I had to use a hacked
version in order to preserve original files and use an alternate
config file location) to pretty everything up at the expense of
doubling the mirror size, or would it be better just to use
$(archive) as apt's Dir::Cache::archives, and get rid of all
the headaches apt-move causes?  And regardless of that, would
it be a good idea to integrate my changes to apt-move into the
main tree?

If you can't tell, I'm currently leaning toward 'ditch it' and
'merge it', but for now I thought I'd just post what works.

Hm.  Just realized I forgot to include a changelog entry, so I'll
have to put it here:

  * 'make mirror': experimental support for mirroring from apt
    sources.

--
James Deikun, Techie(tm), CSI Multimedia
The opinions expressed &c.
Index: Makefile
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/Makefile,v
retrieving revision 1.257
diff -u -r1.257 Makefile
--- Makefile	2000/03/08 15:23:56	1.257
+++ Makefile	2000/03/08 22:19:21
@@ -324,11 +324,18 @@
 	[ -d updates ] || mkdir -p updates
 
 # helper target to mirror base locally
-mirror:
+mirror: mirror_$(mirror_type)
+
+mirror_rsync:
 	[ -d $(archive) ] || mkdir -p $(archive)
 	cd $(archive) && $(top_dir)/mirror_base.sh $(architecture)	\
 		$(mirror_user) $(mirror_site) $(kver) $(top_dir)
 
+mirror_apt:
+	[ -d $(archive) ] || mkdir -p $(archive)
+	cd $(ftp_archive) && $(top_dir)/apt_mirror.sh $(architecture)	\
+		$(kver) $(top_dir)
+
 base_archive	:= base$(subst .,_,$(debianversion)).tgz
 
 build::	localfiles
@@ -527,7 +534,7 @@
 endif
 endif
 
-.PHONY: umount clean distclean
+.PHONY: umount clean distclean mirror mirror_rsync mirror_apt
 umount:
 	-for d in ${tmpdir}/boot-floppies/mnt.*; do umount $$d; done;
 	# also need to unmount /dev/pts and /proc in base-tmp
@@ -548,6 +555,9 @@
 	rm -rf release updates					\
 		scripts/basedisks/new_root_home/messages	\
 		check_basedeps ${tmpdir}/boot-floppies
+	rm -rf apt-mirror/archives apt-mirror/lists		\
+		apt-mirror/status apt-mirror/srcpkgcache.bin	\
+		apt-mirror/pkgcache.bin
 
 $(base_archive):	basedisks.sh \
 			$(shell find scripts/basedisks -type f ) \
Index: config
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/config,v
retrieving revision 1.29
diff -u -r1.29 config
--- config	2000/03/08 11:22:13	1.29
+++ config	2000/03/08 22:19:21
@@ -80,6 +80,11 @@
 #   -- use 'make mirror' to mirror it if you don't have it yet
 archive		:= $(ftp_archive)/dists/$(debname)/main/binary-$(architecture)
 
+# define this to choose between rsync and apt mirrors.  (rsync is
+# better if you have access to an rsync source which is up-to-date).
+# note: if you use apt, you may have to edit apt-mirrors/apt-move.conf.
+mirror_type	:= rsync
+
 # define this to point to a non-standard mirror user and/or site.
 mirror_user	:= $(shell whoami)
 mirror_site	:= master.debian.org:/debian2/debian/dists/potato/main

Attachment: apt_mirror.tgz
Description: GNU Unix tar archive


Reply to: