2 # Sign files and upload them.
4 scriptversion
=2006-10-15.21
6 # Copyright (C) 2004, 2005, 2006 Free Software Foundation
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 # Originally written by Alexandre Duret-Lutz <adl@gnu.org>.
27 GPG
='/usr/bin/gpg --batch --no-tty'
30 usage
="Usage: $0 [OPTIONS]... FILES...
32 Sign all FILES, and upload them to selected destinations.
35 --help print this help text and exit
36 --to DEST specify one destination for FILES
37 (multiple --to options are allowed)
38 --user NAME sign with key NAME
39 --version output version information and exit
41 Recognized destinations are:
42 alpha.gnu.org:DIRECTORY
43 savannah.gnu.org:DIRECTORY
44 savannah.nongnu.org:DIRECTORY
46 build directive files and upload files by FTP
47 [user@]host:DIRECTORY upload files with scp
50 gnupload --to sources.redhat.com:~ftp/pub/automake \\
51 --to alpha.gnu.org:automake \\
52 automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2
54 Report bugs to <bug-automake@gnu.org>.
55 Send patches to <automake-patches@gnu.org>."
57 while test -n "$1"; do
65 echo "$0: Missing argument for --to" 1>&2
74 echo "$0: Missing argument for --user" 1>&2
77 GPG
="$GPG --local-user $2"
82 echo "gnupload $scriptversion"
86 echo "$0: Unknown option \`$1', try \`$0 --help'" 1>&2
96 echo "$0: No file to upload" 1>&2
102 # Make sure all files exist. We don't want to ask
103 # for the passphrase if the script will fail.
106 if test ! -f $file; then
107 echo "$0: Cannot find \`$file'" 1>&2
114 # Make sure passphrase is not exported in the environment.
117 # Reset PATH to be sure that echo is a built-in. We will later use
118 # `echo $passphrase' to output the passphrase, so it is important that
119 # it is a built-in (third-party programs tend to appear in `ps'
120 # listings with their arguments...).
121 # Remember this script runs with `set -e', so if echo is not built-in
123 PATH
=/empty
echo -n "Enter GPG passphrase: "
131 echo "Signing $file..."
133 echo $passphrase |
$GPG --passphrase-fd 0 -ba -o $file.sig
$file
140 echo "Uploading $file to $dest..."
141 files
="$file $file.sig"
142 destdir
=`echo $dest | sed 's/[^:]*://'`
145 rm -f $file.directive
$file.directive.asc
146 cat >$file.directive
<<EOF
151 echo "$passphrase" |
$GPG --passphrase-fd 0 --clearsign $file.directive
152 ncftpput ftp-upload.gnu.org
/incoming
/alpha
$files $file.directive.asc
153 rm -f $file.directive
$file.directive.asc
156 rm -f $file.directive
$file.directive.asc
157 cat >$file.directive
<<EOF
162 echo "$passphrase" |
$GPG --passphrase-fd 0 --clearsign $file.directive
163 ncftpput ftp-upload.gnu.org
/incoming
/ftp $files $file.directive.asc
164 rm -f $file.directive
$file.directive.asc
167 ncftpput savannah.gnu.org
/incoming
/savannah
/$destdir $files
169 savannah.nongnu.org
:*)
170 ncftpput savannah.nongnu.org
/incoming
/savannah
/$destdir $files
180 # eval: (add-hook 'write-file-hooks 'time-stamp)
181 # time-stamp-start: "scriptversion="
182 # time-stamp-format: "%:y-%02m-%02d.%02H"
183 # time-stamp-end: "$"