#!/bin/sh # This script should be launched from the place where the index.html will # be generated # This is where the main index.html should be seen at URL="http://debian.lipn.fr" # This is the title of the index.html TITLE="Debian repositories hosted at LIPN" # This is the name of the keyring package. If none does exist, set to '' # A file by the name $KEYRING.key (or $KEYRING.$dist.key) should exist in # the toplevel directory. If $KEYRING.$dist.key does exist, it takes precedence # over $KEYRING.key # This keyring file should contain the signatures KEYRING="lipn-archive-keyring" # This string will be echo'ed after the key description MOREDETAILS="This key is used only for this purpose and should be signed by key 38D092B4 (you can find some details here)." # This is added to URL to link to the top of the repository DEBIANARCHIVEURL="debian" # This is the file path to reach the top of the repository. DEBIANARCHIVEPATH="debian" # This is at the footer CONTACT="Please contact Jean-Christophe Dubacq if you find any problem with these pages.
Page generated by this program." # This is specific distribution information DISTINFO="lenny:

This distribution may also contain packages that compile only for lenny-backports. In this case, you will need to use backports (esp. debhelper) from Debian backports.

" # LICENSE FOR this file # ================================ # This notice is a simplified BSD license. # Copyright 2010 Jean-Christophe Dubacq. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # THIS SOFTWARE IS PROVIDED BY JEAN-CHRISTOPHE DUBACQ ``AS IS'' AND ANY # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JEAN-CHRISTOPHE DUBACQ OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # The views and conclusions contained in the software and documentation # are those of the authors and should not be interpreted as representing # official policies, either expressed or implied, of Jean-Christophe Dubacq. header_html() { cat << EOF EOF TITLE=$(echo "$TITLE"|recode utf8..html) echo " $TITLE" } closer_html() { echo "

Home. Regenerated $(date +on\ %Y-%m-%d\ at\ %H:%M). $CONTACT

" echo '' echo '' } boilerplate() { if [ -f "${KEYRING}-${dist}.key" ]; then KR="${KEYRING}-${dist}" else if [ -f "${KEYRING}.key" ]; then KR="${KEYRING}" else return fi fi # extract info from key GNUPGHOME=txt/gpg.$KR [ -d $GNUPGHOME ] || mkdir $GNUPGHOME chmod 700 $GNUPGHOME export GNUPGHOME [ -f $GNUPGHOME/pubring.gpg ] || gpg --quiet --no-options --batch --import "${KR}.key" 2>&1 KEYS=$(gpg --list-keys --with-colons|grep ^pub|cut -f5 -d:) OWNER=$(gpg --list-keys --with-colons|grep ^pub|cut -f10 -d:|sed -e 's/[ ]*$//g') LONGFINGERPRINT=$(gpg --list-keys --with-colons|grep ^pub|cut -f5 -d:) echo "

All these packages are signed with a gpg key. The key ID (${LONGFINGERPRINT}) corresponds to the hosting provider (${OWNER}). ${MOREDETAILS}

" echo "

if apt-get update gives you warning about an unverified key such as NO_PUBKEY ${LONGFINGERPRINT}, you can get it with (for example):

" echo "
gpg --keyserver wwwkeys.eu.pgp.net --recv-key ${LONGFINGERPRINT}"
    echo "gpg --export --armor ${LONGFINGERPRINT} | sudo apt-key add -
" echo "

Another possibility is to download the key file from this server and to type sudo apt-key add ${KR}.key.

" echo "

Note that you should really read the documentation about apt-key and gpg if you are concerned (and you should) by security and you do not understand what you do with the two lines above.

" echo "

You should also install the $KR package from this repository, but you will run into the chicken-and-egg problem if you skip the above indications.

" echo "
" } helper_html() { header_html echo "" echo "" echo "

$TITLE

" echo "

Information about the repositories hosted there

" boilerplate echo "

You can examine the pool.

" if [ ! -d "${DEBIANARCHIVEPATH}/dists/$dist" ]; then cat << EOF

This distribution is empty for all architectures!

EOF NCOMP=0 NP=0 NPB=0 else echo '
' echo '

This release

' echo "

You can find information about this release. Please refer to it as such (for architectures $NORMALARCHES):

" echo "
deb $URL $dist $DistComponents"
	TREATSOURCE=0
	if [ -n "$(echo $DistArchitectures|grep source)" ]; then
	    TREATSOURCE=1
	    echo "deb-src $URL $dist $DistComponents"
	fi
	echo "
" if [ $(echo "$DISTINFO"|grep ^$dist: |wc -l) -gt 0 ]; then echo "$DISTINFO"|grep ^$dist:|cut -f2- -d: fi for component in $DistComponents; do treat_component done touch txt/notsourceless_${dist} (cut -f1 -d% txt/list.binary_$dist|LANG=C sort -u;cat txt/notsourceless_${dist} txt/notsourceless_${dist})|LANG=C sort| uniq -u > txt/sourceless_${dist} if [ $(stat -c%s "txt/sourceless_${dist}") -gt 0 ]; then echo '

Binary-only packages

' for component in $DistComponents; do NP=0 if [ -f txt/list.binary_${dist}_${component}.txt ]; then for binpack in $(cat txt/sourceless_${dist}); do if grep -q "^${binpack}%" txt/list.binary_${dist}_${component}.txt; then NP=$((NP+1)) [ "$NP" = 1 ] && echo "

Binary-only packages in ${component}

" done fi echo '
' fi closer_html } binary_snippets() { perl -e 'while (<>) {unless (/^$/) {$pack=$1 if (/^Package: (.*)$/);$vers=$1 if (/^Version: (.*)$/);$arch=$1 if (/^Architecture: (.*)$/);$line.=$_;next;};open OUT,">txt/binary%$pack%$vers%$arch.txt";print OUT $line;close OUT;print "$pack%$vers%$arch\n";$line="";};' < $1 >> $2 } source_snippets() { perl -e 'while (<>) {unless (/^$/) {$pack=$1 if (/^Package: (.*)$/);$vers=$1 if (/^Version: (.*)$/);$line.=$_;next;};open OUT,">txt/source%$pack%$vers.txt";print OUT $line;close OUT;print "$pack%$vers\n";$line="";};' < $1 >> $2 } source_info() { grep "^$1: " "txt/source%$2.txt"|cut -f2- -d' ' } source_list() { grep "^${1}: " "txt/source%$2.txt"|cut -f2- -d' '|sed -e 's/, / /g' } binary_info() { grep "^$1: " "txt/binary%$2.txt"|cut -f2- -d' ' } binary_list() { grep "^${1}: " "txt/binary%$2.txt"|cut -f2- -d' '|sed -e 's/, / /g' } treat_dep() { RESULT="$1" IFS="," for b in $RESULT; do IFS="|" echo -n "
  • " second= for bb in $b; do unset IFS [ -z "$second" ] || echo " | "||true second=1 bb="${bb# }" bb="${bb# }" bbb="$bb" bbb=${bb%% *} adr= if grep -q "^${bbb}%" txt/list.binary; then adr="binpkg.${bbb}.html" fi if [ -z "$adr" ]&& grep -q "^${bbb}:" cache/binary%source; then sourcepack=$(grep "^${bbb}:" cache/binary%source|cut -f2 -d:|head -n 1) if [ "$sourcepack" != "unknown" ]; then if [ "${sourcepack#lib}" != "${sourcepack}" ]; then adr="http://packages.qa.debian.org/${sourcepack%${sourcepack#????}}/${sourcepack}.html" else adr="http://packages.qa.debian.org/${sourcepack%${sourcepack#?}}/${sourcepack}.html" fi else adr="unknown.html" fi fi if [ -z "$adr" ]; then if [ "${bbb#lib}" != "${bbb}" ]; then pqdo="http://packages.qa.debian.org/${bbb%${bbb#????}}/${bbb}.html" else pqdo="http://packages.qa.debian.org/${bbb%${bbb#?}}/${bbb}.html" fi a=$(curl -s "$pqdo"|grep '\(head\)\|\(looked for\)') if [ "$(echo $a|grep 404|wc -l)" -gt 0 ]; then if [ "$(echo $a|grep looked|wc -l)" -gt 0 ]; then sourcepack=$(echo $a|cut -f2 -d\`| cut -f1 -d\') echo "$bbb:$sourcepack">> cache/binary%source if [ "${sourcepack#lib}" != "${sourcepack}" ]; then adr="http://packages.qa.debian.org/${sourcepack%${sourcepack#????}}/${sourcepack}.html" else adr="http://packages.qa.debian.org/${sourcepack%${sourcepack#????}}/${sourcepack}.html" fi else adr="unknown.html" echo "$bbb:unknown">> cache/binary%source fi else adr="$pqdo" echo "$bbb:$bbb">> cache/binary%source fi # adr="http://packages.debian.org/search?keywords=${bbb}&searchon=names&exact=1&suite=all&section=all" fi if [ "$adr" = "unknown.html" ]; then echo -n "$bbb" else echo -n "$bbb" fi if [ "$bbb" != "$bb" ]; then bbc=${bb#* } echo -n " $bbc" fi done echo "
  • " done unset IFS } excerpt_binary() { ARCHES="";BINVERSIONS="" echo -n "" > txt/tmp echo -n "
  • $binpack " for binpackage in $(grep "^${binpack}%" $BLIST|LANG=C sort -u); do binvers=$(binary_info Version $binpackage) binarch=$(binary_info Architecture $binpackage) ARCHES="$ARCHES $binarch" BINVERSIONS="$BINVERSIONS $binvers" binary_info Description $binpackage >> txt/tmp done ARCHES_SUM=$(echo $ARCHES|fmt -w 1|LANG=C sort -u|fmt -w 1000) if [ "$ARCHES_SUM" = "$NORMALARCHES" ]; then ARCHES_SUM="any" fi VERSION_SUM=$(echo $BINVERSIONS|fmt -w 1|LANG=C sort -u|fmt -w 1000) if [ $(echo $VERSION_SUM|fmt -w 1|wc -l) -gt 1 ]; then for binpackage in $(grep "^${binpack}%" $BLIST|LANG=C sort -u); do binvers=$(binary_info Version $binpackage) binarch=$(binary_info Architecture $binpackage) echo -n " [$binarch=$binvers]" done else echo -n " [$ARCHES_SUM=$VERSION_SUM]" fi echo ":" cat txt/tmp|sort|uniq -c|sort -nr|head -1|cut -c8- if [ $(LANG=C sort -u txt/tmp|wc -l) -gt 1 ]; then echo "(there are other descriptions)"; fi } treat_component() { SOURCEFILE="${DEBIANARCHIVEPATH}/dists/${dist}/${component}/source/Sources" LIST="txt/list.sources_${dist}_${component}.txt" if [ $(stat -c%s "$SOURCEFILE") -gt 0 ]; then source_snippets $SOURCEFILE $LIST cat $LIST >> txt/list.source_${dist} cat $LIST >> txt/list.source NCOMP=$((NCOMP+1)) fi BLIST="txt/list.binary_${dist}_${component}.txt" for arch in $NORMALARCHES; do PACKAGEFILE="${DEBIANARCHIVEPATH}/dists/${dist}/${component}/binary-${arch}/Packages" if [ $(stat -c%s "$PACKAGEFILE") -gt 0 ]; then binary_snippets $PACKAGEFILE $BLIST echo "$arch" >> txt/used_arches.${dist}_${component} cat $BLIST >> txt/list.binary_$dist cat $BLIST >> txt/list.binary fi done if [ $(stat -c%s "$SOURCEFILE") -lt 1 ]; then return fi [ "$NCOMP" = 1 ] && echo "

    Source packages

    " echo "

    Source packages in $component

    " echo "" } binary_interstage() { set +e [ "$STAGE" -lt 1 ] && echo "" set -e STAGE=$1 } treat_binarypackage() { TITLE="Binary package $binpkg" header_html echo '' echo '' echo "

    $TITLE

    " for vers in $(grep ^${binpkg}% txt/list.binary|cut -f2 -d%|LANG=C sort -u); do echo "

    Version $vers

    " for version in $(grep ^${binpkg}%${vers}% txt/list.binary|LANG=C sort -u); do VERSION=$(binary_info Version $version) ARCH=$(binary_info Architecture $version) echo "

    [$ARCH]

    " STAGE=0 binary_interstage 2 echo "
  • Short description: $(binary_info Description $version)
  • " echo "
  • Long description:

    " cat txt/binary%${version}.txt |sed -ne '/^Description:/,/^[^ ]/ b lab' -e 'd' -e ':lab' -e '/^[^ ]/ d' -e 's/^ [.]$/<\/p>

    /g' -e 'p' echo "

  • " for art in Homepage $(grep "^Vcs-" "txt/binary%$version.txt"|cut -f1 -d:|LANG=C sort -u) Maintainer Section Source Depends Recommends Suggests Conflicts Breaks Provides; do RESULT=$(binary_info $art $version) if [ "$art" = "Source" ]; then if [ -z "$RESULT" ]; then RESULT="$binpkg" RESULTVERS='' else RESULTVERS="$(echo -n ${RESULTVERS}|sed -ne 's/^.*(\(.*\))$/(\1/g;/^[^(]/ d;s/^(//g;p')" RESULT=${RESULT% *} fi if [ -z "$RESULTVERS" ]; then RESULTVERS="$(echo -n ${vers}|sed -e 's/+b[0-9][0-9]*//g')" fi fi if [ -n "$RESULT" ]; then case $art in Homepage|Vcs-*) binary_interstage 2 echo -n "
  • " case $art in Homepage) echo -n "Project's homepage" ;; Vcs-*) echo -n "${art#Vcs-} access to the packaging source repository" ;; esac echo "
  • " ;; Maintainer|Section|Source) binary_interstage 3 if [ "$art" = "Maintainer" ]; then echo "
  • $art: $RESULT
  • " fi if [ "$art" = "Section" ]; then echo "
  • Debian's classification: $RESULT
  • " fi if [ "$art" = "Source" ]; then if [ -f "txt/source%${RESULT}%${RESULTVERS}.txt" ]; then echo "
  • Source package: ${RESULT}
  • " else if [ $(grep "^${RESULT}%" txt/list.source | wc -l) -gt 0 ]; then echo "
  • Source package: ${RESULT} (version $RESULTVERS)
  • " else echo "
  • Source package: ${RESULT} (version $RESULTVERS)
  • " fi fi fi ;; Depends|Recommends|Suggests|Conflicts|Breaks|Provides) binary_interstage 4 echo "
  • $art:
  • " ;; esac fi done binary_interstage 20 done done closer_html } source_interstage() { set +e [ "$STAGE" -lt 1 ] && echo "" set -e STAGE=$1 } treat_sourcepackage() { TITLE="Source package $pack" header_html echo '' echo '' echo "

    $TITLE

    " for version in $(grep ^${pack}% txt/list.source|LANG=C sort -u); do VERSION=$(source_info Version $version) echo "

    Version ${VERSION}

    " STAGE=0 for art in Binary Homepage Maintainer $(grep "^Vcs-" "txt/source%$version.txt"|cut -f1 -d:|LANG=C sort -u) Format Standards-Version Architecture Build-Depends Build-Depends-Indep Section Directory; do RESULT=$(source_info $art $version) if [ -n "$RESULT" ]; then case $art in Binary) source_interstage 1 BINARY=$(source_list Binary $version) BINARIES=$(echo $BINARY|fmt -w 1|LANG=C sort -u) echo "
  • Binary packages:
  • " ;; Homepage|Vcs-*) source_interstage 2 echo -n "
  • " case $art in Homepage) echo -n "Project's homepage" ;; Vcs-*) echo -n "${art#Vcs-} access to the packaging source repository" ;; esac echo "
  • " ;; Maintainer|Format|Standards-Version) source_interstage 2 case "$art" in Maintainer) tagline="Debian package maintainer" ;; *) tagline="$art" ;; esac echo "
  • $tagline: $RESULT
  • " ;; Architecture) source_interstage 3 echo "
  • $art: $RESULT
  • " ;; Build-Depends*) source_interstage 3 echo "
  • $art:
  • " ;; Section) source_interstage 4 echo "
  • $art: $RESULT
  • " ;; Directory) source_interstage 4 POOLADR="${URL}/${DEBIANARCHIVEURL}/${RESULT}" echo "
  • Pool location: ${RESULT}
  • " ;; *) echo "
  • $art: $RESULT
  • " ;; esac fi done source_interstage 4 INDIST='' for dist in $DISTS; do if [ -f "txt/list.source_${dist}" ] && grep -q "^${version}$" txt/list.source_${dist}; then INDIST="${INDIST} $dist," || true fi done INDIST=${INDIST%,} echo "
  • Available in: $INDIST
  • " SUBPOOLADR=$(echo -n "${POOLADR}"|sed -e 's/\//\\\//g') cat txt/source%${version}.txt |sed -ne '/^Files:/,/^[^ ]/ b lab' -e 'd' -e ':lab' -e '/^[^ ]/ d' -e 's/^ \([a-f0-9]*\) \([0-9]*\) \(.*\)$/
  • \3<\/a> (MD5: \1, \2 bytes)<\/li>/g' -e "s/__XXX__/${SUBPOOLADR}/g" -e 'p' source_interstage 20 done closer_html } [ -d cache ] || mkdir cache [ -d html ] || mkdir html [ -d txt ] || mkdir txt rm -rf html/*.html txt/* DISTS=$(grep ^Codename: ${DEBIANARCHIVEPATH}/conf/distributions|cut -f2 -d:) header_html > index.html echo '' >> index.html echo '' >> index.html echo "

    $TITLE

    " >> index.html echo '
    ' >> index.html closer_html >> index.html for pack in $(cut -f1 -d% txt/list.source|LANG=C sort -u); do treat_sourcepackage > html/package.$pack.html done for binpkg in $(cut -f1 -d% txt/list.binary|LANG=C sort -u); do treat_binarypackage > html/binpkg.$binpkg.html done