[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Format of Release file and tools to create



On Wed, Sep 24, 2003 at 08:39:06PM +0000, debacle@debian.org wrote:
> Which is the tool (of choice) to create the files?

I wrote a small script myself now, but I'm sure, that other
people did better.  See attachment.  At least it seems to
work with the apt-get/apt-move/FAI tool-chain.

Cheers!

#!/bin/sh

ORIGIN="Debian"
LABEL="Debian"
SUITE="testing"
CODENAME="sarge"
DESC="Debian Testing distribution - Not Released"

args=`getopt c:d:l:o:s: $*`
for o
    do case "$o" in
        -c) CODENAME="$2"; shift; shift;;
        -d) DESC="$2"; shift; shift;;
        -l) LABEL="$2"; shift; shift;;
        -o) ORIGIN="$2"; shift; shift;;
        -s) SUITE="$2"; shift; shift;;
        --) shift; break;;
    esac
done

####

DATE=`date -u`
PACKAGES=`find . -name Packages -o -name Packages.gz -o \
    -name Sources -o -name Sources.gz`
DIRS=`for p in $PACKAGES; do dirname $p; done|sort -u`
COMPS=`for d in $DIRS; do echo $d | \
    sed 's,[^A-Za-z0-9-]*\([A-Za-z0-9-]*\)/.*,\1,'; done|sort -u`
ARCHS=`for d in $DIRS; do echo $d | \
    sed 's,.*binary-\([A-Za-z0-9-]*\),\1,'; done|sort -u`

for d in $DIRS; do
    cd $d
        ARCH=`echo $d | sed 's,.*binary-\([A-Za-z0-9-]*\),\1,'`
        COMP=`echo $d | sed 's,[^A-Za-z0-9-]*\([A-Za-z0-9-]*\)/.*,\1,'`
        echo "Archive: $SUITE
Component: $COMP
Origin: $ORIGIN
Label: $LABEL
Architecture: $ARCH" > Release
    cd -
done

rm -f Release
MD5FILES=`find . -name Packages -o -name Packages.gz -o \
    -name Sources -o -name Sources.gz -o -name Release \
    | sed 's,^[^/]*/,,'`

echo "Origin: $ORIGIN
Label: $LABEL
Suite: $SUITE
Codename: $CODENAME
Date: $DATE
Architectures:" `echo $ARCHS`"
Components:" `echo $COMPS`"
Description: $DESC
MD5Sum:" > Release

for m in $MD5FILES; do
    echo -n " " >> Release
    SIZE=`wc -c $m | sed 's/ *\([0-9]*\).*/\1/'`
    SUM=`md5sum $m | sed 's/^ *\([A-Fa-f0-9]*\) .*/\1/'`
    printf "%s %16d %s\n" $SUM $SIZE $m >> Release
done


Reply to: