Beruflich Dokumente
Kultur Dokumente
2005-01-20 IMPORTANT : I realized that I included .udebs in the main Packages files. This is bad. Udebs should only
be in the debian-installer Packages file. Please update your config files accordingly.
Introduction
This page describes the steps used to create a custom debian install cd using a partial mirror, mostly gathered from
a prototype system's apt cache. The instructions here assume i386 but should work for any architecture simply by
replacing i386 in the instructions with the architecture of your choice.
This article began when there was a realization that there was no information on how to create a Debian partial
mirror without first having a full mirror. Subsequent programs such as deb-mirror and the like required that one start
with a full mirror [ DD 2005-03-11 : I misread the man pages there - deb-mirror doesn't require a full mirror locally,
but does require that you know the package names of the packages you want in the mirror, though it apparently
does pull in dependencies. I'll definitely look into that when I finish my current project which is categorizing every
available package for aptitude ] which doesn't work if you don't have a high speed connection or bandwidth caps.
The decision was made to try creating a custom partial mirror using a network install cd and what was downloaded
using Aptitude on an older system that was being refurbished. It took alot more work than expected, but is now
functional.
Quick Overview
APT {
["FTPArchive"] {
Release {
Origin "debian-cd";
Label "yousarge";
Suite "testing";
Version "0.1";
Codename "sarge";
Architectures "i386";
Components "main contrib";
Description "Your Sarge CD Set";
};
};
};
And the following yourcdname-di.conf (creating the directories described therein, as necessary):
Dir {
ArchiveDir "/debian";
OverrideDir "indices";
CacheDir "/tmp";
};
TreeDefault {
Directory "pool/";
};
BinDirectory "pool/main" {
Packages "dists/sarge/main/debian-installer/binary-i386/Packages";
BinOverride "override.sarge.main";
ExtraOverride "override.sarge.extra.main";
};
Default {
Packages {
Extensions ".udeb";
};
Contents {
Compress "gzip";
};
};
o
o
o
Dir {
ArchiveDir "/debian";
OverrideDir "indices";
CacheDir "/tmp";
};
TreeDefault {
Directory "pool/";
};
BinDirectory "pool/main" {
Packages "dists/sarge/main/binary-i386/Packages";
BinOverride "override.sarge.main";
ExtraOverride "override.sarge.extra.main";
};
BinDirectory "pool/contrib" {
Packages "dists/sarge/contrib/binary-i386/Packages";
BinOverride "override.sarge.contrib";
ExtraOverride "override.sarge.extra.contrib";
};
BinDirectory "pool/non-free" {
Packages "dists/sarge/non-free/binary-i386/Packages";
BinOverride "override.sarge.non-free";
ExtraOverride "override.sarge.extra.non-free";
};
Default {
Packages {
Extensions ".deb";
Compress ". gzip";
};
Contents {
Compress "gzip";
};
};
o Create a list of packages you want on the cd (probably just a list of files in your pool dir).
o Assuming you have debian-cd installed, follow the directions in /usr/share/debian-cd.
o In the mirrorcheck step, if any missing Depends: are listed, download the packages into your pool dir
to correct that, regenerate your packages files, and start the debian-cd instructions over again (you
may need to exit the shell you started the procedure in because debian-cd alters the environment
while it builds the cd set).
o In the make list step watch for debconf_required errors, and as above download the needed
packages, regenerate package lists, and restart the debian-cd procedure.
o Assuming sucessful completion of the CD building procedure burn your CD and test.
Detailed Instructions
1. Getting Your Packages
Part I: Get Your Base System
Use aptitude or AptGet to download the packages you want on the system and cd.
Get AptMove (e.g. apt-get install apt-move)
Modify apt-move.conf to use your pool directory as its local mirror (LOCALDIR)
AptMove your other packages to your pool directory (e.g. /home/debian/pool) by typing: apt-move update
Figure out what packages you'll need (this is the hard part because of dependencies).
Download them individually (if you make a list and use wget on the list, it wouldn't be as painful, but keeping
up with changing versions would rapidly become painful) into the pool directory in the filesystem where
you'll be doing your work (e.g. /home/debian/pool). You can use aptitude download <package> ....
Don't forget any dependencies (by hand! ugh!).
Use Aptitude or AptGet to download the packages you want on the system and cd.
Get AptMove (e.g. apt-get install apt-move)
Modify apt-move.conf to use a temporary directory as its local mirror (LOCALDIR)
AptMove your other packages to a temporary directory (e.g. /home/debian/tmp) by typing: apt-move update
Use the following script to copy packages from the temporary directory to your pool directory (e.g.
/home/debian/pool). This is my preferred mode of operation because I have more control over what happens
to what apt-move calls the 'mirror' (the pool directory), especially when building cd's for testing or unstable,
which change quickly.
#!/bin/bash
function print_usage {
echo
echo
echo
echo
echo
echo
echo
}
if [ "$1" = "--move" ] ; then
MOVE=1
if [ "$2" = "--keep-old" ] ; then
KEEP=1
else
KEEP=0
fi
else
MOVE=0
if [ "$1" = "--keep-old" ] ; then
KEEP=1
else
KEEP=0
fi
fi
if [ -z "$1" ]; then
print_usage
exit
fi
if [ -z "$2" ]; then
print_usage
exit
fi
if [ $MOVE -eq 1 -a -z "$3" ]; then
print_usage
exit
else
if [ $KEEP -eq 1 -a -z "$3" ]; then
print_usage
exit
fi
fi
if [ $MOVE -eq 1 -a $KEEP -eq 1 -a -z "$4" ]; then
print_usage
exit
fi
if [ $MOVE -eq 0 -a $KEEP -eq 0 ]; then
["RC1DIR"]=$1
["RC2DIR"]=$2
else
if [ $MOVE -eq 1 -a $KEEP -eq 1 ]; then
["RC1DIR"]=$3
["RC2DIR"]=$4
else
["RC1DIR"]=$2
["RC2DIR"]=$3
fi
fi
echo "Copying from $["RC1DIR"] to $["RC2DIR"]"
TMPFILE=`tempfile`
cd $["RC1DIR"]
find pool -type f || sort >$TMPFILE
rc1base=$["RC1DIR"]
rc2base=$["RC2DIR"]
cd for rc1file in `cat $TMPFILE`; do
pkgfullname=`basename $rc1file`
pkgname=`echo $pkgfullname || cut -f1 -d_`
rc1ver=`echo $pkgfullname || cut -f2 -d_`
pooldir=`dirname $rc1file`
pkgend=`echo $pkgfullname || cut -f3 -d_`
rc2file=`ls $rc2base/$pooldir/$pkgname\__*\__$pkgend 2>/dev/null`
if [ "$rc2file" ]; then
rc2maxver="!!!!!!!!!!!!!!!!!"
rc2maxfile="!!!!!!!!!!!!!!!!"
for rc2match in $rc2file; do
rc2pkgfullname=`basename $rc2match`
Option 2
1.
2.
function print_usage {
echo
echo
3. Get overrides.<dist>.*
1.
2.
If you want to includes packages from non-US you ought to create another indices directory (e.g. indices-non-US),
and get the overrides from a non-US mirror (from /debian-non-US/indices-non-US).
4. Generate Packages.gz and Release files for your 'distribution'
execute the command in the directory containing the pool and dists directories
apt-ftparchive -c custom-cd-scripts/apt.conf generate custom-cd-scripts/customcd-di.conf
repeat for the binary-i386 directories (under main, contrib, non-free):
o using the following customcd.conf instead of customcd-di.conf:
o
Dir {
o
ArchiveDir "/debian";
o
OverrideDir "indices";
o
CacheDir "/tmp";
o
};
TreeDefault {
Directory "pool/";
};
BinDirectory "pool/main" {
Packages "dists/sarge/main/binary-i386/Packages";
BinOverride "override.sarge.main";
ExtraOverride "override.sarge.extra.main";
};
BinDirectory "pool/contrib" {
Packages "dists/sarge/contrib/binary-i386/Packages";
BinOverride "override.sarge.contrib";
ExtraOverride "override.sarge.extra.contrib";
};
BinDirectory "pool/non-free" {
Packages "dists/sarge/non-free/binary-i386/Packages";
BinOverride "override.sarge.non-free";
ExtraOverride "override.sarge.extra.non-free";
};
Default {
Packages {
Extensions ".deb";
Compress ". gzip";
};
Contents {
Compress "gzip";
};
};
If you are using any non-US packages you will need to repeat the above Packages file creation in each of the
appropriate subdirectories.
You can do this by hand, or if you just want to include the latest versions of everything in your mirror (pool)
directory, you can use something like this script:
#!/bin/sh
function print_usage {
echo gen-task-dfdsarge pool-directory
}
if [ -z "$1" ] ; then
print_usage
exit
fi
POOLDIR=$1
TMPFILE=`/bin/tempfile`
if [ `expr substr $POOLDIR 1 1` != \/ ]; then
POOLDIR=`pwd`/$POOLDIR
fi
IFS=$'\n'
for package in `find $POOLDIR -type f`; do
pkgfilename=`basename $package`
pkgname=`echo $pkgfilename||cut -f1 -d_`
echo $pkgname>>$TMPFILE
done
cat $TMPFILE || sort -u
Alternatively combine the approaches and remove packages you don't want. Note that dependencies are
resolved for any debs (but not udebs), so don't be afraid to removing the lib packages (that way only
what you actually need, or manually want to include, are added to the cd), except for lib*-udeb*
which should be left so the installer works correctly.
6. Install and Configure debian-cd
Download and install the debian-cd package (e.g. apt-get install debian-cd)
cd /usr/share/debian-cd and edit CONF.sh
A sample CONF.sh is reproduced below:
#
# This file will have to be sourced where needed
#
# Unset all optional variables first to start from a clean state
unset NONUS
|||| true
unset ["FORCENONUSONCD1"] |||| true
unset NONFREE
|||| true
unset CONTRIB
|||| true
unset EXTRANONFREE
|||| true
unset LOCAL
|||| true
unset LOCALDEBS
|||| true
unset SECURED
|||| true
unset SECURITY
|||| true
unset BOOTDIR
|||| true
unset BOOTDISKS
|||| true
unset SYMLINK
|||| true
unset COPYLINK
|||| true
unset MKISOFS
|||| true
unset MKISOFS_OPTS
|||| true
unset ISOLINUX
|||| true
unset EXCLUDE
|||| true
unset SRCEXCLUDE
|||| true
unset NORECOMMENDS
|||| true
unset NOSUGGESTS
|||| true
unset DOJIGDO
|||| true
unset JIGDOCMD
|||| true
unset JIGDOTEMPLATEURL |||| true
unset JIGDOFALLBACKURLS |||| true
unset JIGDOINCLUDEURLS |||| true
unset JIGDOSCRIPT
|||| true
unset DEFBINSIZE
|||| true
unset DEFSRCSIZE
|||| true
unset FASTSUMS
|||| true
unset PUBLISH_URL
|||| true
unset PUBLISH_NONUS_URL |||| true
unset PUBLISH_PATH
|||| true
unset UDEB_INCLUDE
|||| true
unset UDEB_EXCLUDE
|||| true
unset BASE_INCLUDE
|||| true
unset BASE_EXCLUDE
|||| true
unset INSTALLER_CD
|||| true
unset DI_CODENAME
|||| true
unset MAXCDS
|||| true
unset SPLASHPNG
|||| true
# The debian-cd dir
# Where I am (hoping I'm in the debian-cd dir)
export BASEDIR=`pwd`
# Building sarge cd set ...
export CODENAME=sarge
# By default use Debian installer packages from $CODENAME
if [ ! "$DI_CODENAME" ]
then
export DI_CODENAME=$CODENAME
fi
# If set, controls where the d-i components are downloaded from.
# This may be an url, or "default", which will make it use the default url
# for the daily d-i builds. If not set, uses the official d-i images from
# the Debian mirror.
#export DI_WWW_HOME=default
# Version number, "2.2 r0", "2.2 r1" etc.
export DEBVERSION="3.1"
# Official or non-official set.
# NOTE: THE "OFFICIAL" DESIGNATION IS ONLY ALLOWED FOR IMAGES AVAILABLE
# ON THE OFFICIAL DEBIAN CD WEBSITE http://cdimage.debian.org
#export OFFICIAL="Unofficial"
#export OFFICIAL="Official"
#export OFFICIAL="Official Beta"
export OFFICIAL="Daniel's Unofficial Debian Sarge (testing)"
# ... for arch
export ARCH=`dpkg --print-installation-architecture`
# IMPORTANT : The 4 following paths must be on the same partition/device.
#
If they aren't then you must set COPYLINK below to 1. This
#
takes a lot of extra room to create the sandbox for the ISO
#
images, however. Also, if you are using an NFS partition for
#
some part of this, you must use this option.
# Paths to the mirrors
#export MIRROR=/ftp/debian
export MIRROR=/home/archive/debian
# Comment the following line if you don't have/want non-US
#export NONUS=/ftp/debian-non-US
# And this option will make you 2 copies of ["CD1"] - one with all the
# non-US packages on it, one with none. Useful if you're likely to
# need both.
#export ["FORCENONUSONCD1"]=1
# Path of the temporary directory
#export TDIR=/ftp/tmp
export TDIR=/debian/tmp
# Path where the images will be written
#export OUT=/rack/debian-cd
export OUT=/debian/debian-cd
# Where we keep the temporary apt stuff.
# This cannot reside on an NFS mount.
#export APTTMP=/ftp/tmp/apt
export APTTMP=/debian/tmp-apt
# Do I want to have NONFREE merged in the CD set
# export NONFREE=1
# Do I want to have CONTRIB merged in the CD set
export CONTRIB=1
#
#
#
#
If your local packages are not under $MIRROR, but somewhere else,
you can uncomment this line and edit to to point to a directory
containing dists/$CODENAME/local/binary-$ARCH
export LOCALDEBS=/home/joey/debian/va/debian
#
#
#
#
#
#
#
#
Options
export MKISOFS=/usr/bin/mkisofs
export MKISOFS_OPTS="-r"
#For normal users
export MKISOFS_OPTS="-r -F ." #For symlink farmers
# ["Image"] and ["Servers"] sections of the .jigdo file. You can provide
# your own script if you need the .jigdo file to contain different
# data.
#export JIGDOSCRIPT="myscript"
# If set, use the md5sums from the main archive, rather than calculating
# them locally
#export FASTSUMS=1
# A couple of things used only by publish_cds, so it can tweak the
# jigdo files, and knows where to put the results.
# You need to run publish_cds manually, it is not run by the Makefile.
export PUBLISH_URL="http://cdimage.debian.org/jigdo-area"
export PUBLISH_NONUS_URL="http://non-US.cdimage.debian.org/jigdo-area"
export PUBLISH_PATH="/home/jigdo-area/"
# Where to find the boot disks
#export BOOTDISKS=$TOPDIR/ftp/skolelinux/boot-floppies
# File with list of packages to include when fetching modules for the
# first stage installer (debian-installer). One package per line.
# Lines starting with '#' are comments. The package order is
# important, as the packages will be installed in the given order.
#export UDEB_INCLUDE="$BASEDIR"''data''$CODENAME/udeb_include
# File with list of packages to exclude as above.
#export UDEB_EXCLUDE="$BASEDIR"''data''$CODENAME/udeb_exclude
# File with list of packages to include when running debootstrap from
# the first stage installer (currently only supported in
# debian-installer). One package per line. Lines starting with '#'
# are comments. The package order is important, as the packages will
# be installed in the given order.
#export BASE_INCLUDE="$BASEDIR"''data''$CODENAME/base_include
# File with list of packages to exclude as above.
#export BASE_EXCLUDE="$BASEDIR"''data''$CODENAME/base_exclude
# Only put the installer onto the cd (set NORECOMMENDS,... as well).
# INSTALLER_CD=0: nothing special (default)
# INSTALLER_CD=1: just add debian-installer (use TASK=tasks/debian-installer)
# INSTALLER_CD=2: add d-i and base (use TASK=tasks/debian-installer+kernel)
#export INSTALLER_CD=0
export INSTALLER_CD=1
# Parameters to pass to kernel when the CD boots. Not currently supported
# for all architectures.
#export KERNEL_PARAMS="DEBCONF_PRIORITY=critical"
# If set, limits the number of binary ["CDs"] to produce.
#export MAXCDS=1
# If set, overrides the boot picture used.
#export SPLASHPNG="$BASEDIR/data/$CODENAME/splash-img.png"
# Used by build.sh to determine what to build, this is the name of a target
# in the Makefile. Use bin-official_images to build only binary ["CDs"]. The
# default, official_images, builds everything.
#IMAGETARGET=official_images
Note that INSTALLER_CD is set to 1. This includes tasks/debian-installer+kernel, and some other 'magic'. Just
make sure the list of packages you produced as instructed above has all the kernel and debian-installer
packages, and that tasks/debian-installer+kernel doesn't list any outdated packages.
Also note that the directories must all be on the same filesystem (except those under /usr/share/debian-cd)