#!/usr/bin/perl

use strict;
use File::Find;

my $incoming = "/home/apt/incoming";

my @unsigned = qw(

  freeradius_1.0.0+cvs20040609-0.hs.5_i386.changes

);

my $vc = "gpg --verify";
my $cc = "gpg --clearsign";

for (@unsigned) {

  my $f = "$incoming/$_";

  # since we use a fixed list of unsigned files we shouldnt sign them twice
  my $r = qx/$vc $f 2>&1/;
  next unless $?;

  print "Attempting to sign [$f] .. ";
  system("$cc $f") == 0 or warn "system([$cc] [$f]) failed: [$?] [$!]\n";
  rename("$f.asc", $f) or warn "rename([$f.asc], [$f]) failed: [$!]\n";
  print "finished\n";

}
