Building a signed repository

To be able use a repository for debian-installer, the repository needs to be signed.

Creating a key to sign the repository with

You should create a new key (and possibly a new local user), that are used to signe the archive. The reason is that for things to go automaticly, you need a key with no passphrase, or else you will need to update your repository manually.

cat << EOF | gpg --batch --gen-key
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
Subkey-Length: 1024
Name-Real: Builder autosigner
Name-Comment: This is used by a repository
Expire-Date: $(date -d +2year +%Y-%m-%d)
%echo done

Using reprepro to build a repository

I use reprepro to help me build and sign the mirror. My you might download my config-file for reprepro and store it as conf/distributions and you need to create a override/override (it might be empty) To include sources into your repositories, you also need to create an (empty) override/srcoverride. Then you might initialize your repository by running:

reprepro export

Setting up apt to fetch debs and source

I use apt to fetch the packages needed for installation, and then I use reprepro to add the into our repository. First I create the needed files to let apt fetch and remember which files it already has 'installed' :)

mkdir -p apt/state/lists/partial
mkdir -p apt/cache
mkdir -p incoming/partial
touch apt/status

Then I set up a sources.list as apt/sources.list using my own local mirror, debian-security, debian upstream, and debian-edu upstream.

apt needs a little tuning to be able to fetch to be stored into our little repository

apt-get --assume-yes $(for OPT in $APTOPTIONS ; do echo -n "-o $OPT " ; done) update

Fetching the udebs

First I start by fetching every udeb from debian etch and debian-edu etch


    MIRROR=$(echo $UDEBMIRROR| sed -ne 's:/dists/etch/.*::p')
    for UDEB in $(wget -qO - $UDEBMIRROR/debian-installer/binary-i386/Packages.bz2 | \
                  bzip2 -cd | sed -ne 's/^Filename: //p') ; do
        test -f $UDEB && continue
        wget -nd -P incoming $MIRROR/$UDEB || continue
        find incoming -name "*.udeb"
            -exec reprepro --delete includeudeb etch {} \;
        SRC=$(basename $(dirname $UDEB))
        ( cd incoming ; \
          apt-get --assume-yes --download-only \
                  $(for OPT in $APTOPTIONS ; do echo -n "-o $OPT " ; done) \
                  source $SRC

Fetching the debs

There are 3 types of files we know that we need.

DEBOOTSTRAP="$(/usr/sbin/debootstrap --print-debs etch 
               apt/debootstrap | 
               grep -v "^#")"
EASYPKGS="installation-report linux-image-2.6-486 grub lvm2 
         debian-edu-install debian-edu-archive-keyring"
HARDPKGS="console-data console-common console-tools 
          localization-config usbutils acpi acpid libc6-i686
          mdetect xresprobe read-edid education-tasks"

apt-get --assume-yes --download-only \
        $(for OPT in $APTOPTIONS ; do echo -n "-o $OPT " ; done) 
for DEB in $(find incoming -name "*.deb") ; do 
    reprepro --delete includedeb etch $DEB
    SRC=$(basename $DEB | cut -f1 -d_)
    ( cd incoming ; \
      apt-get --assume-yes --download-only \
              $(for OPT in $APTOPTIONS ; do echo -n "-o $OPT " ; done) \
              source $SRC

Adding source

If you want to make the mirror public available, you should also include the source files, Since we've downloaded the source while fetching the udebs and the debs, it's rather easy to add the source into the repository.

for DSC in $(find incoming -name "*.dsc") ; do 
    SRC=$(basename $DSC | cut -f1 -d_)
    apt-cache $(for OPT in $APTOPTIONS ; do echo -n "-o $OPT " ; done) showsrc $SRC | \
        while read KEY VALUE ; do
            case "$KEY" in
                Section:) SECTION=$VALUE ;;
                Priority:) PRIO=$VALUE ;;
                    test -f $DSC || continue
                    reprepro --delete -P $PRIO -S $SECTION \
                             includedsc etch $DSC

Adding every file from the dvd

If you want to build your own mirror for offline installation, I guess you could do like this:

find /media/dvd -type f -name "*.deb" \
    -exec reprepro includedeb etch {} \;