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
The top-level script; I called it mirror-new-cd-set.
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.
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
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.
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
pool-delcd: Calls the script to unmount the image and remove the fstab entry for this cd. As usual the name matters.
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
- I am assuming you are using Debian
You need the symlinks package installed.
You need the jigdo-lite package installed.
You need to have directory for the iso images, a directory for a set of subdirectories for mounted cd contents for each cd, and a directory such that you will have <full-path-of-directory>/pool once the script adds (or adds to) the pool directory.
- You should put all scripts in /usr/local/bin except the -fstab scripts, which should go in /usr/local/bin
- You should give any user who will be adding, deleting, or updating the cd-to-pool archive permissions in /etc/sudoers so that they can execute /usr/local/sbin/pool-addcd-to-fstab and /usr/local/sbin/pool-delcd-from-fstab without a password, e.g. by saying
user host=(root) NOPASSWD: /usr/local/sbin/pool-addcd-to-fstab user host=(root) NOPASSWD: /usr/local/sbin/pool-delcd-from-fstab
You need to have enough loopback mounts available. This is done by having a file name *.conf in /etc/modprobe.d with a line like:
options loop max_loop 255
4. Basic Usage
Assuming the following:
- version is 500 (lenny initial release)
- iso images are to be in: /srv/debcd/i386/cd-500
- cd-contents are to be in: /srv/debcd-contents/i386/cd-500
- pool directory is in: /srv/debian
- jigdo images are to be in /srv/debcd/i386/cd-jigdo-500
- cd's are using the filenames they were released with
you want to use jidgo images from http://cdimage.debian.org/debian-cd/5.0.0/i386/jigdo-cd/
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:
- old version is 4.0_r6 (etch point release 6)
- new version is 500 (lenny initial release)
- architecture is i386
- old iso images are to be in: /srv/debcd/i386/cd-4.0_r6
- old cd-contents are to be in: /srv/debcd-contents/i386/cd-4.0_r6
- new iso images are to be in: /srv/debcd/i386/cd-500
- new cd-contents are to be in: /srv/debcd-contents/i386/cd-500
- jigdo images are to be in /srv/debcd/i386/cd-jigdo-500
- pool directory is in: /srv/debian
- cd's are using the filenames they were released with
you want to use jidgo images from http://cdimage.debian.org/debian-cd/5.0.0/i386/jigdo-cd/
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
Copyright: Copyright 2009 Daniel F. Dickinson and any additional contributor (after inital publication) This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this file, if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.