Erstellen von herunterladbaren Jigsaw-Abbildern für DVD und CD

aus openSUSE, der freien Wissensdatenbank


Inhaltsverzeichnis

Einführung

Auf dieser Seite soll beschrieben werden, wie jemand, der Zugriff auf DVD- und/oder CD-Abbilder hat, herunterladbare Jigsaw-Abbilder erstellen kann und wie ein Benutzer diese wiederum zum Herunterladen der Abbilder benutzen kann. Der Vorteil von Jigsaw-Abbildern liegt darin, dass eine beliebige Anzahl von DVD-/CD-Abbildern verteilt werden kann, ohne dass unnötig viel Platz dafür verbraucht wird.

Ersparnisse

Wie groß sind die Ersarnisse?

Beispielhaft gezeigt anhand des CD-Satzes von SUSE Linux 10.1 Alpha1.

Der originale CD-Satz

601MB    SUSE-10.1-CD-OSS-i386-Alpha1-CD1.iso
649MB    SUSE-10.1-CD-OSS-i386-Alpha1-CD2.iso
685MB    SUSE-10.1-CD-OSS-i386-Alpha1-CD3.iso
665MB    SUSE-10.1-CD-OSS-i386-Alpha1-CD4.iso
525MB    SUSE-10.1-CD-OSS-i386-Alpha1-CD5.iso
3.1GB    total
662MB    SUSE-10.1-CD-OSS-ppc-Alpha1-CD1.iso
688MB    SUSE-10.1-CD-OSS-ppc-Alpha1-CD2.iso
694MB    SUSE-10.1-CD-OSS-ppc-Alpha1-CD3.iso
679MB    SUSE-10.1-CD-OSS-ppc-Alpha1-CD4.iso
536MB    SUSE-10.1-CD-OSS-ppc-Alpha1-CD5.iso
3.2GB    total
643MB    SUSE-10.1-CD-OSS-x86_64-Alpha1-CD1.iso
686MB    SUSE-10.1-CD-OSS-x86_64-Alpha1-CD2.iso
687MB    SUSE-10.1-CD-OSS-x86_64-Alpha1-CD3.iso
662MB    SUSE-10.1-CD-OSS-x86_64-Alpha1-CD4.iso
536MB    SUSE-10.1-CD-OSS-x86_64-Alpha1-CD5.iso
3.2GB    total

Die herunterladbaren Jigsaw-Abbilder

i386

188KB    SL-10.1-OSS-alpha1.jigdo
8.6MB    SUSE-10.1-CD-OSS-i386-Alpha1-CD1.template
132KB    SUSE-10.1-CD-OSS-i386-Alpha1-CD2.template
14MB     SUSE-10.1-CD-OSS-i386-Alpha1-CD3.template
156KB    SUSE-10.1-CD-OSS-i386-Alpha1-CD4.template
116KB    SUSE-10.1-CD-OSS-i386-Alpha1-CD5.template
23MB     total

Das ist offensichtlich ziemlich enorm. Beachten Sie, dass es nur noch 0.72% der ursprünglichen Größe sind!

ppc

188KB    SL-10.1-OSS-alpha1.jigdo
124MB    SUSE-10.1-CD-OSS-ppc-Alpha1-CD1.template
200MB    SUSE-10.1-CD-OSS-ppc-Alpha1-CD2.template
134MB    SUSE-10.1-CD-OSS-ppc-Alpha1-CD3.template
76MB     SUSE-10.1-CD-OSS-ppc-Alpha1-CD4.template
195MB    SUSE-10.1-CD-OSS-ppc-Alpha1-CD5.template
728MB    total

Hier sind es nur 22% der Originalgröße, was nicht so gut ist, wie bei i386. Warum ist das so? Aus verschiedenen Gründen baut SUSE die noarch-Pakete für jede Plattform separat. Deshalb verfügt die ppc-Version über untschiedliche noarch-Pakete als auf dem Server, weshalb die Platzersparnisse kleiner sind, als auf der i386-Plattform. Wenn für alle Plattformen die gleichen noarch-Pakete benutzt würden, läge die Gesamtgröße auch nur bei etwa 23MB an Stelle von 728MB.

x86_64

188KB    SL-10.1-OSS-alpha1.jigdo
118MB    SUSE-10.1-CD-OSS-x86_64-Alpha1-CD1.template
200MB    SUSE-10.1-CD-OSS-x86_64-Alpha1-CD2.template
134MB    SUSE-10.1-CD-OSS-x86_64-Alpha1-CD3.template
77MB     SUSE-10.1-CD-OSS-x86_64-Alpha1-CD4.template
177MB    SUSE-10.1-CD-OSS-x86_64-Alpha1-CD5.template
704MB    total

Ebenfalls nur 22% der urpsrünglichen Größe, aus den selben Gründen wie bei ppc.

Erstellen der Abbilder

Nachdem Sie das Jigdo-Paket installiert haben, können Sie folgendes Skript benutzen.

#!/bin/bash
#
# mkjigdo - make jigdo files for all ISO images in one directory
# Copyright (C) 2005  Robert Schiele <rschiele@uni-mannheim.de>
#
# This program 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 program 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 program; if not, write to the Free Software Foundation, Inc., 51
# Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#

set -eu

usage()
{
    cat << EOT

Usage: $0 [OPTIONS]
Options:
  -b WORD  Basename of the jigdo file (=BASENAME)
  -c FILE  Configuration file to load
  -i PATH  Path for image files (=ISODIR)
  -j PATH  Path for jigdo files (=JIGDODIR)
  -m WORD  List of mirror servers separated by \`,' (=MIRRORS)
  -r PATH  Relative path on all mirrors (=RELDIR)
  -s PATH  Path for file storage (=SRCDIR)
  -t PATH  Path for temporary files and cache (=TMPDIR)
  -h       Output this help
  -v       Output version info
EOT
}

# set some plain stupid defaults
BASENAME=a
RELDIR=.
ISODIR=.
JIGDODIR=.
TMPDIR=.
SRCDIR=.
MIRRORS="ftp://localhost/pub"

# read standard config file
test -f ~/.$(basename "$0")rc && . ~/.$(basename "$0")rc

# parse command line
while [ "$*" ]; do
    case "$1" in
        -b) BASENAME="$2"; shift;;
        -c) . "$2"; shift;;
        -h) usage; exit;;
        -i) ISODIR="$2"; shift;;
        -j) JIGDODIR="$2"; shift;;
        -m) MIRRORS="${2//,/ }"; shift;;
        -r) RELDIR="$2"; shift;;
        -s) SRCDIR="$2"; shift;;
        -t) TMPDIR="$2"; shift;;
        -v) echo mkj version 0.0; exit 0;;
        *)  usage >&2; exit 1;;
    esac
    shift
done

# run jigdo on all ISO files
JIGDOLIST=
for ISO in "$ISODIR"/*.iso; do
    BASEFILE="${ISO/*\/}"
    BASEFILE="${BASEFILE/.iso}"
    case "$BASEFILE" in
        *.delta) ;;
        *) jigdo-file mt --bzip2 -i "$ISO" -j "$TMPDIR/$BASEFILE.jigdo.tmp" \
            -t "$JIGDODIR/$BASEFILE.template" -c "$TMPDIR/$BASENAME.cache" \
            "$SRCDIR"
            JIGDOLIST="$JIGDOLIST $TMPDIR/$BASEFILE.jigdo.tmp";;
    esac
done

# merge all temporary jigdo files into one file
{
    awk '/^[[]/{if(a==1)a=2}/^\[Image\]/{a=1}{if(a<2)print}' $JIGDOLIST
    echo '[Servers]'
    for i in $MIRRORS; do
        echo A="$i/$RELDIR/"
    done
    echo
    echo '[Parts]'
    awk '/^[[#]/{a=0}/^\[Parts\]/{a=1}/^[^[]/{if(a==1)print}' $JIGDOLIST | \
        sort -t= -k2 -u
} | gzip -c9 > "$JIGDODIR/$BASENAME.jigdo"

Sie können alle Optionen sowohl auf der Kommandozeile angeben, als auch in der Konfigurationsdatei ~/.mkjigdorc. In folgendem Beispiel werden Jigdo-Dateien für SUSE Linux 10.1 Alpha1 erstellt:

BASENAME=SL-10.1-OSS-alpha1
RELDIR=distribution/SL-OSS-factory
BASEDIR=/pub/opensuse/$RELDIR/
ISODIR=/pub/opensuse/distribution/$BASENAME/iso
JIGDODIR=res
TMPDIR=tmp
SRCDIR=$BASEDIR/inst-source
MIRRORS="ftp://ftp.opensuse.org/pub/opensuse
         ftp://ftp.gwdg.de/pub/opensuse"

Veröffentlichen Sie jetzt nur noch die .jigdo- und alle.template-Dateien auf dem FTP Server und Sie sind fertig.

Herunterladen der Abbilder

Wenn Sie Abbilder herunterladen wollen, benötigen Sie als erstes Jigsaw Download von http://atterer.net/jigdo/ (Versionen für Linux und Windows verfügbar) oder spezielle Pakete für SUSE LINUX 9.2, 9.3, oder 10.0 von http://pi3.informatik.uni-mannheim.de/~schiele/suse/ sowie .jigdo und .template für das entsprechende Abbild welches Sie wollen.

Wie Sie die Anwendung starten wird hier auf englisch beschrieben.

Auf Heise Online können Sie auch eine Anleitung auf Deutsch finden.