#!/bin/sh # generate Release files for a Debian mirror # 2003-10, W. Borgert # Released under the terms of the GNU General Public License # 2012-12 Modified by Jorge Suárez de Lis ORIGIN="Ubuntu" LABEL="Ubuntu CITIUS" SUITE="lucid" CODENAME="precise" DESC="Paquetes para Ubuntu CITIUS 12.04" UNPACK=0 ARCHIVE=. SIGN_RELEASE=0 SIGN_KEY=0 # long options not yet implemented args=`getopt 'a:c:d:l:o:s:u' $*` for o do case "$o" in -a | --arch*) ARCHIVE="$2"; shift; shift;; -c | --code*) CODENAME="$2"; shift; shift;; -d | --desc*) DESC="$2"; shift; shift;; -l | --label) LABEL="$2"; shift; shift;; -o | --orig*) ORIGIN="$2"; shift; shift;; -s | --suite) SUITE="$2"; shift; shift;; -u | --unpa*) UNPACK=1; shift;; --) shift; break;; esac done #### cd $ARCHIVE DATE=`date -u` if [ $UNPACK -eq 1 ]; then PACKAGGZ=`find . -follow -name Packages.gz -o -name Sources.gz` for p in $PACKAGGZ; do gunzip -c $p > `dirname $p`/`basename $p .gz` done fi PACKAGES=`find . -follow -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 . -follow -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 echo "SHA1:" >> Release for m in $MD5FILES; do echo -n " " >> Release SIZE=`wc -c $m | sed 's/ *\([0-9]*\).*/\1/'` SUM=`sha1sum $m | sed 's/^ *\([A-Fa-f0-9]*\) .*/\1/'` printf "%s %16d %s\n" $SUM $SIZE $m >> Release done if [ $SIGN_RELEASE -eq 1 ] ; then gpg --armor --default-key $SIGN_KEY --yes -b -o $ARCHIVE/Release.gpg $ARCHIVE/Release fi