#!/usr/bin/perl

# $Progeny: debsigs-autosign,v 1.5 2001/06/27 18:08:33 jgoerzen Exp $

$| = 1;

# Regular

#%ids = ('maint' => '94978B22',
#	'archive' => '8910543F',
#	'origin' => 'E435EC07');

# Bootstrapping

%ids = ('maint' => 'FBDCFE92',
	'archive' => '0CEB1123',
	'origin' => 'E435EC07');
$secring = '/cdrom/secring.gpg';

@tosign = @ARGV;
unless (defined($tosign[0])) {
  die "Syntax: $0 sigtype [sigtype ...]\n";
}

while (defined($line = <STDIN>)) {
  chomp $line;
  print "Signing $line:";
  foreach $sig (@tosign) {
    print " $sig";
    (system("debsigs", "-K", $secring, "--default-key=" .
	    $ids{$sig}, "--sign=$sig", $line) == 0) or die
	      "Error signing!";
  }
  print ".\n";
}

