1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
#! /bin/sh
# distribute-gnu.sh version 0.2
# upload file for distribution to gnu ftp site and mirrors.
# Copyright (C) 2006 Free Software Foundation, Inc.
# Written by Claudio Fontana <claudio@gnu.org>, 2006.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# This software depends on the following programs to run correctly:
# /bin/sh
# basename
# gpg
# ftp
#
# Ensure that you have them reachable through PATH before running this script.
#
# This script also assumes that you already generated/registered your key
# for the ftp uploads.
#
# For more information about the procedure see the
# "Information for maintainers of GNU software"
#
# http://www.gnu.org/prep/maintain/
as_me=`basename ${0}`
PACKAGE_VERSION=distribute-gnu-0.1
if test $# -lt 1 ; then
echo "$as_me: insufficient arguments. Try --help" >&2
exit 2
fi
HOST=ftp-upload.gnu.org
TARGET=ftp
DIRECTORY=
PACKAGE=
BASE_PACKAGE=
COMMENT=
simulate=0
debug=0
processing_options=1
for ARG in "$@"
do
if test $processing_options = 1 ; then
case $ARG in
-h | --help)
echo "Usage: $as_me [OPTIONS] DIRECTORY FILENAME"
echo "Example: $as_me gnupod gnupod-0.28.tar.gz"
echo " "
echo "OPTIONS:"
echo "-h, --help this help"
echo "-v, --version show script version"
echo " "
echo "-h, --host=HOSTNAME (def:ftp-upload.gnu.org)"
echo "-t, --target=HOSTNAME [ftp|alpha] (def:ftp)"
echo "-c, --comment=COMMENT (def:no comment)"
echo "-s, --simulation do not perform the upload"
echo "-d, --debug show more information"
echo " "
echo "DIRECTORY: the destination directory on the remote host"
echo "FILENAME: the file to distribute"
echo " "
exit 0
;;
-v | --version)
echo "$PACKAGE_VERSION (C) 2006 Free Software Foundation Inc."
echo "Written by Claudio Fontana, 2006."
exit 0
;;
-h*)
HOST="${ARG#-h}"
continue
;;
--host=*)
HOST="${ARG#--host=}"
continue
;;
-t*)
TARGET="${ARG#-t}"
continue
;;
--target=*)
TARGET="${ARG#--target=}"
continue
;;
-c*)
COMMENT="${ARG#-c}"
continue
;;
--comment=*)
COMMENT="${ARG#--comment=}"
continue
;;
-s | --simulation)
simulate=1
continue
;;
-d | --debug)
debug=1
continue
;;
-*)
echo "$as_me: unknown option: $ARG" >&2
exit 2
esac
fi
processing_options=0
if test "x$DIRECTORY" = "x" ; then
DIRECTORY="${ARG}"
continue
fi
if test "x$PACKAGE" = "x" ; then
PACKAGE="${ARG}"
continue;
fi
echo "$as_me: too many arguments." >&2
exit 2
done
if test "x$DIRECTORY" = "x" ; then
echo "$as_me: missing required DIRECTORY argument." >&2
exit 2
fi
if test "x$PACKAGE" = "x" ; then
echo "$as_me: missing required FILENAME argument." >&2
exit 2
fi
if test -f "$PACKAGE" ; then
:
else
echo "$as_me: ${PACKAGE} is not an existing regular file." >&2
exit 2
fi
BASE_PACKAGE=`basename ${PACKAGE}`
if test "$debug" = "1" ; then
echo "HOST=${HOST}"
echo "TARGET=${TARGET}"
echo "DIRECTORY=${DIRECTORY}"
echo "PACKAGE=${PACKAGE}"
echo "BASE_PACKAGE=${BASE_PACKAGE}"
echo "COMMENT=${COMMENT}"
fi
if gpg -b --yes ${PACKAGE} ; then
:
else
echo "$as_me: failed to sign package using gpg." >&2
exit 2
fi
echo "version: 1.1" > ${PACKAGE}.directive
echo "directory: ${DIRECTORY}" >> ${PACKAGE}.directive
echo "filename: ${BASE_PACKAGE}" >> ${PACKAGE}.directive
if test "x$COMMENT" != "x" ; then
echo "comment: ${COMMENT}" >> ${PACKAGE}.directive
fi
if gpg --clearsign --yes ${PACKAGE}.directive ; then
:
else
echo "$as_me: failed to sign directive file using gpg." >&2
exit 2
fi
if test "$simulate" != "0" ; then
exit 0
fi
#upload results to ftp.
ftp -p ${HOST}<<EOF
cd /incoming/${TARGET}
binary
put ${PACKAGE} ${BASE_PACKAGE}
put ${PACKAGE}.sig ${BASE_PACKAGE}.sig
put ${PACKAGE}.directive.asc ${BASE_PACKAGE}.directive.asc
EOF
|