2 # Sign files and upload them.
4 scriptversion=2004-01-28.17
6 # Copyright (C) 2004 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., 59 Temple Place - Suite 330, 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 build directive files and upload files by FTP
43 ftp.gnu.org:DIRECTORY build directive files and upload files by FTP
44 [user@]host:DIRECTORY upload files with scp
47 gnupload --to sources.redhat.com:~ftp/automake \\
48 --to alpha.gnu.org:automake \\
49 automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2
51 Report bugs to <bug-automake@gnu.org>.
52 Send patches to <automake-patches@gnu.org>."
54 while test -n "$1"; do
62 echo "$0: Missing argument for --to" 1>&2
71 echo "$0: Missing argument for --user" 1>&2
74 GPG="$GPG --local-user $2"
79 echo "gnupload $scriptversion"
83 echo "$0: Unknown option \`$1', try \`$0 --help'" 1>&2
93 echo "$0: No file to upload" 1>&2
99 # Make sure all files exist. We don't want to ask
100 # for the passphrase if the script will fail.
103 if test ! -f $file; then
104 echo "$0: Cannot find \`$file'" 1>&2
111 # Make sure passphrase is not exported in the environment.
114 # Reset PATH to be sure that echo is a built-in. We will later use
115 # `echo $passphrase' to output the passphrase, so it is important that
116 # it is a built-in (third-party programs tend to appear in `ps'
117 # listings with their arguments...).
118 # Remember this script runs with `set -e', so if echo is not built-in
120 PATH=/empty echo -n "Enter GPG passphrase: "
128 echo "Signing $file..."
130 echo $passphrase | $GPG --passphrase-fd 0 -ba -o $file.sig $file
137 echo "Uploading $file to $dest..."
138 files="$file $file.sig"
141 rm -f $file.directive $file.directive.asc
142 echo directory: `echo $dest | sed 's/[^:]*://'` >$file.directive
143 echo "$passphrase" | $GPG --passphrase-fd 0 --clearsign $file.directive
144 ncftpput ftp-upload.gnu.org /incoming/alpha $files $file.directive.asc
145 rm -f $file.directive $file.directive.asc
148 rm -f $file.directive $file.directive.asc
149 echo directory: `echo $dest | sed 's/[^:]*://'` >$file.directive
150 echo "$passphrase" | $GPG --passphrase-fd 0 --clearsign $file.directive
151 ncftpput ftp-upload.gnu.org /incoming/ftp $files $file.directive.asc
152 rm -f $file.directive $file.directive.asc
162 # eval: (add-hook 'write-file-hooks 'time-stamp)
163 # time-stamp-start: "scriptversion="
164 # time-stamp-format: "%:y-%02m-%02d.%02H"
165 # time-stamp-end: "$"