#!/bin/bash # Copyright (c) 2005 Peter Palfrader # WARNING: spaces in filenames/paths considered harmful. export SCRIPTVARS=/org/backports.org/dak/config/backports.org/vars . $SCRIPTVARS cd ${configdir} for suite in etch lenny; do source="${ftpdir}/dists/${suite}-backports" target="${base}/buildd/dists/${suite}-backports" if ! [ -d "$source" ]; then echo "Source '$source' does not exist or is not a directory or we can't acess it." >&2 exit 1; fi if ! [ -d "$target" ]; then echo "Target '$target' does not exist or is not a directory or we can't acess it." >&2 exit 1; fi for file in $( cd "$source" && find . -name 'Packages.gz' -o -name 'Packages' -o -name 'Sources.gz' -o -name 'Sources' -o -name 'Release' ); do basedir=$(dirname "$file") basename=$(basename "$file") targetdir="$target/$basedir" [ -d "$targetdir" ] || mkdir -p "$targetdir" if [ "$basename" = "Release" ]; then cp -a "$source/$file" "$target/$file" echo 'NotAutomatic: yes' >> "$target/$file" else cp -a "$source/$file" "$target/$file" fi done # postprocess top level Release file if ! [ -e "$target/Release" ]; then echo "Did not find $target/Release after copying stuff. something's fishy" >&2 exit 1; fi cd "$target" perl -a -p -i -e ' if (substr($_,0,1) eq " ") { if ($in_sha1 || $in_md5) { ($hash, $size, $file) = @F; $_="",next unless -f $file; (undef,undef,undef,undef,undef,undef,undef,$filesize, undef,undef,undef,undef,undef) = stat($file); if ($size != $filesize) { if ($in_sha1) { $hash = `sha1sum "$file" | cut -d " " -f 1` } else { $hash = `md5sum "$file" | cut -d " " -f 1` }; chomp $hash; $_ = sprintf(" %s %16d %s\n", $hash, $filesize, $file); } } } else { $in_sha1 = ($F[0] eq "SHA1:") ? 1 : 0; $in_md5 = ($F[0] eq "MD5Sum:") ? 1 : 0; } ' Release rm -f ${base}/buildd/dists/${suite}-backports/Release.gpg gpg --no-options --batch --no-tty --secret-keyring ${base}/s3kr1t/dot-gnupg/secring.gpg --output "Release.gpg" --armor --detach-sign "Release" done