2 # Sign files and upload them.
4 scriptversion
=2008-04-02.19
6 # Copyright (C) 2004, 2005, 2006, 2007, 2008 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 3, 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, see <http://www.gnu.org/licenses/>.
21 # Originally written by Alexandre Duret-Lutz <adl@gnu.org>.
25 GPG
='gpg --batch --no-tty'
28 usage
="Usage: $0 [OPTIONS]... FILES...
30 Sign all FILES, and upload them to selected destinations, according to
31 <http://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>.
34 --help print this help text and exit
35 --to DEST specify one destination for FILES
36 (multiple --to options are allowed)
37 --user NAME sign with key NAME
38 --version output version information and exit
40 Recognized destinations are:
41 alpha.gnu.org:DIRECTORY
42 savannah.gnu.org:DIRECTORY
43 savannah.nongnu.org:DIRECTORY
45 build directive files and upload files by FTP
46 [user@]host:DIRECTORY upload files with scp
49 gnupload --to sources.redhat.com:~ftp/pub/automake \\
50 --to alpha.gnu.org:automake \\
51 automake-1.8.2b.tar.gz automake-1.8.2b.tar.bz2
53 Report bugs to <bug-automake@gnu.org>.
54 Send patches to <automake-patches@gnu.org>."
56 while test -n "$1"; do
64 echo "$0: Missing argument for --to" 1>&2
73 echo "$0: Missing argument for --user" 1>&2
76 GPG
="$GPG --local-user $2"
81 echo "gnupload $scriptversion"
85 echo "$0: Unknown option \`$1', try \`$0 --help'" 1>&2
95 echo "$0: No file to upload" 1>&2
101 # Make sure all files exist. We don't want to ask
102 # for the passphrase if the script will fail.
105 if test ! -f $file; then
106 echo "$0: Cannot find \`$file'" 1>&2
113 # Make sure passphrase is not exported in the environment.
116 # Reset PATH to be sure that echo is a built-in. We will later use
117 # `echo $passphrase' to output the passphrase, so it is important that
118 # it is a built-in (third-party programs tend to appear in `ps'
119 # listings with their arguments...).
120 # Remember this script runs with `set -e', so if echo is not built-in
122 PATH
=/empty
echo -n "Enter GPG passphrase: "
130 echo "Signing $file..."
132 echo $passphrase |
$GPG --passphrase-fd 0 -ba -o $file.sig
$file
139 echo "Uploading $file to $dest..."
140 files
="$file $file.sig"
141 destdir
=`echo $dest | sed 's/[^:]*://'`
144 rm -f $file.directive
$file.directive.asc
145 cat >$file.directive
<<EOF
148 filename: `basename -- "$file"`
150 echo "$passphrase" |
$GPG --passphrase-fd 0 --clearsign $file.directive
151 ncftpput ftp-upload.gnu.org
/incoming
/alpha
$files $file.directive.asc
152 rm -f $file.directive
$file.directive.asc
155 rm -f $file.directive
$file.directive.asc
156 cat >$file.directive
<<EOF
159 filename: `basename -- "$file"`
161 echo "$passphrase" |
$GPG --passphrase-fd 0 --clearsign $file.directive
162 ncftpput ftp-upload.gnu.org
/incoming
/ftp $files $file.directive.asc
163 rm -f $file.directive
$file.directive.asc
166 ncftpput savannah.gnu.org
/incoming
/savannah
/$destdir $files
168 savannah.nongnu.org
:*)
169 ncftpput savannah.nongnu.org
/incoming
/savannah
/$destdir $files
179 # eval: (add-hook 'write-file-hooks 'time-stamp)
180 # time-stamp-start: "scriptversion="
181 # time-stamp-format: "%:y-%02m-%02d.%02H"
182 # time-stamp-end: "$"