Debian CD Set for Pool Directory

1. Introduction

This HOWTO introduces a set of scripts that make it easy to create and maintain pool directory from a set of loop mounted .iso's (CD images). This makes it more likely that one will have the space to mirror the debian CD's and a debian mirror at the same time. Updates are easy and take only a little bandwitch because jidgo is used to take the existing pool to build the new iso. In addition, assuming space is at a premium, this script updates the cd's and removes old ones as it goes instead of building the whole new set and then deleting the old one (or leaving it). If this is not the desired behaviour the scripts can, of course, be modified.

2. The scripts

  1. The top-level script; I called it mirror-new-cd-set.

  2. mirror-new-cd: This is how it is called by the top-level script. It does the processing of each iso by calling (as needed) jigdo, the pool-addcd and pool-delcd scripts.

  3. pool-addcd: This tool must have the stated name as it is called by mirror-cd. It creates a subdirectory for mounting the image, adds the image to /etc/fstab and mounts it (by calling the pool-add-cdto-fstab script using sudo) and calls the script that creates links in the pool directory to the cd contents

  4. pool-addcd-files: This creates links to the mounted cd contents directory from the pool directory (so that the pool directory has a listing of all the cd contents, except duplicated files point to the last cd processed). And again the name matters.

  5. pool-addcd-to-fstab: Creates the entry in /etc/fstab for the current image's loop mount and mounts it. Keep the name as described

  6. pool-delcd: Calls the script to unmount the image and remove the fstab entry for this cd. As usual the name matters.

  7. pool-delcd-from-fstab: Unmounts the image and removes the fstab entry created by pool-addcd-to-fstab. Used when updating, and as it called by mirror-new-cd you need keep the name pool-delcd-from-fstab unless you want to change said caller.

3. Requirements

user    host=(root) NOPASSWD: /usr/local/sbin/pool-addcd-to-fstab
user    host=(root) NOPASSWD: /usr/local/sbin/pool-delcd-from-fstab

options loop max_loop 255

4. Basic Usage

Assuming the following:

4.1 You have a mirror but no CD images

Try using the following:

mirror-new-cd-set /srv/debcd/i386 /srv/debcd-contents/i386 500 /srv/debian 4 --jigdo-url http://cdimage.debian.org/debian-cd/5.0.0/i386/jigdo-cd/

and when jigdo prompts, leave the scan for files prompt empty, but at the mirror prompt point to your local mirror.

4.2 You have CD images but no mirror

First make sure the pol directory exists, then try:

mirror-new-cd-set /srv/debcd/i386 /srv/debcd-contents/i386 500 /srv/debian 4 --from-iso

4.3 You don't have a mirror or CD images

Try using the following:

mirror-new-cd-set /srv/debcd /srv/debcd-contents 500 /srv/debian 4 --jigdo-url http://cdimage.debian.org/debian-cd/5.0.0/i386/jigdo-cd/

and when jigdo prompts, leave the scan for files prompt empty, but at the mirror prompt point to your preferred mirror.

5. Updating

Assuming the following:

You should be able to:

mirror-new-cd-set /srv/debcd /srv/debcd-contents 500 /srv/debian 4 --jigdo-url http://cdimage.debian.org/debian-cd/5.0.0/i386/jigdo-cd/ --old-version 4.0_r6

6. Keeping Old Versions

Just don't specify any --old parameters

7. Multiple architectures

As you may have guessed you need to run the script for each architecture, substituting the chosen architecture for i386 in each case.


Good Luck!

Please note that I can't do any more work on this, at least for a while, because I have had to eliminate the server that had the debian mirror and pool cd's

Also note: if you have people mirroring from your mirror via rsync make sure they don't copy symlinks but instead copy actual files