124 |
done |
done |
125 |
} |
} |
126 |
|
|
127 |
|
generate_gpg_signature() { |
128 |
|
local files="$@" |
129 |
|
|
130 |
|
if [ -z "$(command -v gpg)" ]; then |
131 |
|
echo "$me: gpg could not be found in \$PATH, please make sure it is installed" >&2 |
132 |
|
exit 1 |
133 |
|
fi |
134 |
|
|
135 |
|
echo "$me: generating GPG signatures, please enter your passphrase when asked" |
136 |
|
|
137 |
|
for file in $files; do |
138 |
|
if [ -f "$file.sig" ]; then |
139 |
|
echo "$me: signature file $file.sig already exists, skipping" >&2 |
140 |
|
continue |
141 |
|
fi |
142 |
|
|
143 |
|
echo "$me: generating GPG signature for $file" |
144 |
|
gpg --detach-sign --armor -o - -- "$file" > "$file.sig" |
145 |
|
|
146 |
|
if [ $? -ne 0 ]; then |
147 |
|
echo "$me: failed to generate signature for $file" >&2 |
148 |
|
rm -f "$file.sig" |
149 |
|
exit 1 |
150 |
|
fi |
151 |
|
done |
152 |
|
} |
153 |
|
|
154 |
check_requirements |
check_requirements |
155 |
|
|
156 |
remote="ssh.onesoftnet.eu.org" |
remote="localhost" |
157 |
method="scp" |
method="scp" |
158 |
username="" |
username="" |
159 |
password="" |
password="" |
262 |
echo "$me: authenticating as $username" |
echo "$me: authenticating as $username" |
263 |
fi |
fi |
264 |
|
|
265 |
echo "$me: files to upload: $files" |
generate_gpg_signature "$files" |
266 |
|
|
267 |
|
echo "$me: files to upload: $files (with GPG signatures)" |
268 |
|
|
269 |
|
sigs="" |
270 |
|
|
271 |
|
for file in $files; do |
272 |
|
sigs="$sigs $file.sig" |
273 |
|
done |
274 |
|
|
275 |
|
files="$files $sigs" |
276 |
|
|
277 |
time_start=$(date +%s) |
time_start=$(date +%s) |
278 |
|
|
358 |
time_end=$(date +%s) |
time_end=$(date +%s) |
359 |
time_diff=$((time_end - time_start)) |
time_diff=$((time_end - time_start)) |
360 |
|
|
361 |
|
echo "$me: cleaning up signature files" |
362 |
|
|
363 |
|
for sigfile in $sigs; do |
364 |
|
rm -f "$sigfile" |
365 |
|
done |
366 |
|
|
367 |
echo "$me: upload complete in ${time_diff}s" |
echo "$me: upload complete in ${time_diff}s" |