~ubuntu-branches/ubuntu/saucy/debsigs/saucy

« back to all changes in this revision

Viewing changes to debsigs-autosign

  • Committer: Bazaar Package Importer
  • Author(s): Branden Robinson
  • Date: 2002-09-19 17:55:29 UTC
  • Revision ID: james.westby@ubuntu.com-20020919175529-8cjsoswzc882un47
Tags: 0.1.14
* debsigs, debsigs-autosign: you can't use a module and run one of its
  methods at the same time; do these things separately (thanks, Joey Hess)
  (Closes: #161542)
* debsigs: stop hard-coding the path to gpg (thanks, Joey Hess)
  (Closes: #161543)
* debsigs: update $VERSION
* debsigs: add FUTURE DIRECTIONS section to POD
* debsigs-signchanges: only dig into @ARGV if it's defined (thanks, Joey
  Hess) (Closes: #161540)
* debsigs-installer: wrote rudimentary manpage

* debian/control:
  - bump Standards-Version to 3.5.7 (no changes needed)
  - add dependency on gnupg (Closes: #161544)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
# Copyright (C) 2001,2002 Progeny Linux Systems, Inc.
 
4
# Authors: John Goerzen, Branden Robinson
 
5
 
 
6
# This program is free software; you can redistribute it and/or modify
 
7
# it under the terms of the GNU General Public License as published by
 
8
# the Free Software Foundation; either version 2 of the License, or
 
9
# (at your option) any later version.
 
10
#
 
11
# This program is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License
 
17
# along with this program; if not, write to the Free Software
 
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
 
 
20
use Getopt::Long;
 
21
 
 
22
Getopt::Long::Configure('no_ignore_case');
 
23
 
 
24
$| = 1;
 
25
 
 
26
# set up variables
 
27
 
 
28
my $verbose = '';
 
29
 
 
30
my $maint_keyid = $ENV{DEBSIGS_MAINT_ID} ? $ENV{DEBSIGS_MAINT_ID} : '';
 
31
my $archive_keyid = $ENV{DEBSIGS_ARCHIVE_ID} ? $ENV{DEBSIGS_ARCHIVE_ID} : '';
 
32
my $origin_keyid = $ENV{DEBSIGS_ORIGIN_ID} ? $ENV{DEBSIGS_ORIGIN_ID} : '';
 
33
my $secring = $ENV{DEBSIGS_SECRING} ? $ENV{DEBSIGS_SECRING} : "$ENV{HOME}/.gnupg/secring.pgp";
 
34
 
 
35
GetOptions ('verbose' => \$verbose,
 
36
            'maint=s' => \$maint_keyid,
 
37
            'archive=s' => \$arhive_keyid,
 
38
            'origin=s' => \$origin_keyid,
 
39
            'secring=s' => \$secring);
 
40
 
 
41
%ids = ('maint' => $maint_keyid,
 
42
        'archive' => $archive_keyid,
 
43
        'origin' => $origin_keyid);
 
44
 
 
45
@tosign = @ARGV;
 
46
unless (defined($tosign[0])) {
 
47
  die <<EOF;
 
48
Usage: debsigs-autosign [options] sigtype [ ... ]
 
49
  Reads package names from standard input, and signs each with debsigs.
 
50
Options:
 
51
  --archive=KEYID    use KEYID for archive signature
 
52
  --maint=KEYID      use KEYID for maintainer signature
 
53
  --origin=KEYID     use KEYID for origin signature
 
54
  --secring=FILE     use FILE as GPG secret keyring
 
55
  --verbose          report status messages
 
56
EOF
 
57
}
 
58
 
 
59
while (defined($line = <STDIN>)) {
 
60
  chomp $line;
 
61
  if ($verbose) {
 
62
    print "Signing $line:";
 
63
  }
 
64
  foreach $sig (@tosign) {
 
65
    if ($verbose) {
 
66
      print " $sig";
 
67
    }
 
68
    (system("debsigs", "-K", $secring, "--default-key=" .
 
69
            $ids{$sig}, "--sign=$sig", $line) == 0) or die
 
70
              "Error signing!";
 
71
  }
 
72
  if ($verbose) {
 
73
    print ".\n";
 
74
  }
 
75
}
 
76
 
 
77
__END__
 
78
 
 
79
=head1 NAME
 
80
 
 
81
debsigs-autosign - batch-sign Debian package files
 
82
 
 
83
=head1 SYNOPSIS
 
84
 
 
85
B<debsigs-autosign> [I<options>] I<sigtype> [ I<...> ]
 
86
 
 
87
=head1 DESCRIPTION
 
88
 
 
89
I<debsigs-autosign> reads a newline-delimited list of file names from
 
90
standard input and runs I<debsigs>(1) on each package, with arguments
 
91
determined by the options, operands, and environment of
 
92
I<debsigs-autosign>.
 
93
 
 
94
=head1 OPTIONS
 
95
 
 
96
=over 5
 
97
 
 
98
=item B<--archive=>I<keyid>
 
99
 
 
100
=item B<--maint=>I<keyid>
 
101
 
 
102
=item B<--origin=>I<keyid>
 
103
 
 
104
The above options specify cryptographic key identifiers for use with
 
105
I<gpg>(1).
 
106
 
 
107
=item B<--secring=>I<file>
 
108
 
 
109
This option identifies a secret keyring file for use with I<gpg>(1).
 
110
 
 
111
=item B<--verbose>
 
112
 
 
113
Displays verbose output.
 
114
 
 
115
=back
 
116
 
 
117
=head1 OPERANDS
 
118
 
 
119
Each operand is a signature type to apply to the Debian package(s) to be
 
120
processed.  Currently recongnized signature types are B<archive>,
 
121
B<maint>, and B<origin>.
 
122
 
 
123
=head1 ENVIRONMENT
 
124
 
 
125
The following environment variables are recognized by
 
126
I<debsigs-autosign>:
 
127
 
 
128
=over 5
 
129
 
 
130
=item I<DEBSIGS_ARCHIVE_ID>
 
131
 
 
132
=item I<DEBSIGS_MAINT_ID>
 
133
 
 
134
=item I<DEBSIGS_ORIGIN_ID>
 
135
 
 
136
The above variables specify cryptographic key identifiers for use with
 
137
I<gpg>(1).
 
138
 
 
139
=item I<DEBSIGS_SECRING>
 
140
 
 
141
This variable identifies a secret keyring file for use with I<gpg>(1).
 
142
 
 
143
=back
 
144
 
 
145
=head1 AUTHORS
 
146
 
 
147
=over 5
 
148
 
 
149
=item John Goerzen <jgoerzen@complete.org>
 
150
 
 
151
=item Branden Robinson <branden@debian.org>
 
152
 
 
153
=back
 
154
 
 
155
=head1 SEE ALSO
 
156
 
 
157
debsigs(1), debsig-verify(1), gpg(1)
 
158
 
 
159
=cut
 
160
 
 
161
# vim:set ai et sts=2 sw=2 tw=72: