|
Packit Service |
9646c7 |
#!/bin/sh
|
|
Packit Service |
9646c7 |
# Sign files and upload them.
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
scriptversion=2012-01-15.15; # UTC
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
# Copyright (C) 2004-2012 Free Software Foundation, Inc.
|
|
Packit Service |
9646c7 |
#
|
|
Packit Service |
9646c7 |
# This program is free software; you can redistribute it and/or modify
|
|
Packit Service |
9646c7 |
# it under the terms of the GNU General Public License as published by
|
|
Packit Service |
9646c7 |
# the Free Software Foundation; either version 2, or (at your option)
|
|
Packit Service |
9646c7 |
# any later version.
|
|
Packit Service |
9646c7 |
#
|
|
Packit Service |
9646c7 |
# This program is distributed in the hope that it will be useful,
|
|
Packit Service |
9646c7 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
9646c7 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
9646c7 |
# GNU General Public License for more details.
|
|
Packit Service |
9646c7 |
#
|
|
Packit Service |
9646c7 |
# You should have received a copy of the GNU General Public License
|
|
Packit Service |
9646c7 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
# Originally written by Alexandre Duret-Lutz <adl@gnu.org>.
|
|
Packit Service |
9646c7 |
# The master copy of this file is maintained in the gnulib Git repository.
|
|
Packit Service |
9646c7 |
# Please send bug reports and feature requests to bug-gnulib@gnu.org.
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
set -e
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
GPG='gpg --batch --no-tty'
|
|
Packit Service |
9646c7 |
conffile=.gnuploadrc
|
|
Packit Service |
9646c7 |
to=
|
|
Packit Service |
9646c7 |
dry_run=false
|
|
Packit Service |
9646c7 |
symlink_files=
|
|
Packit Service |
9646c7 |
delete_files=
|
|
Packit Service |
9646c7 |
delete_symlinks=
|
|
Packit Service |
9646c7 |
collect_var=
|
|
Packit Service |
9646c7 |
dbg=
|
|
Packit Service |
9646c7 |
nl='
|
|
Packit Service |
9646c7 |
'
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
usage="Usage: $0 [OPTION]... [CMD] FILE... [[CMD] FILE...]
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
Sign all FILES, and process them at selected destinations according to CMD.
|
|
Packit Service |
9646c7 |
<http://www.gnu.org/prep/maintain/html_node/Automated-FTP-Uploads.html>
|
|
Packit Service |
9646c7 |
explains further.
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
Commands:
|
|
Packit Service |
9646c7 |
--delete delete FILES from destination
|
|
Packit Service |
9646c7 |
--symlink create symbolic links
|
|
Packit Service |
9646c7 |
--rmsymlink remove symbolic links
|
|
Packit Service |
9646c7 |
-- treat the remaining arguments as files to upload
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
Options:
|
|
Packit Service |
9646c7 |
--help print this help text and exit
|
|
Packit Service |
9646c7 |
--to DEST specify one destination for FILES
|
|
Packit Service |
9646c7 |
(multiple --to options are allowed)
|
|
Packit Service |
9646c7 |
--user NAME sign with key NAME
|
|
Packit Service |
9646c7 |
--symlink-regex[=EXPR] use sed script EXPR to compute symbolic link names
|
|
Packit Service |
9646c7 |
--dry-run do nothing, show what would have been done
|
|
Packit Service |
9646c7 |
--version output version information and exit
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
If --symlink-regex is given without EXPR, then the link target name
|
|
Packit Service |
9646c7 |
is created by replacing the version information with '-latest', e.g.:
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
foo-1.3.4.tar.gz -> foo-latest.tar.gz
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
Recognized destinations are:
|
|
Packit Service |
9646c7 |
alpha.gnu.org:DIRECTORY
|
|
Packit Service |
9646c7 |
savannah.gnu.org:DIRECTORY
|
|
Packit Service |
9646c7 |
savannah.nongnu.org:DIRECTORY
|
|
Packit Service |
9646c7 |
ftp.gnu.org:DIRECTORY
|
|
Packit Service |
9646c7 |
build directive files and upload files by FTP
|
|
Packit Service |
9646c7 |
download.gnu.org.ua:{alpha|ftp}/DIRECTORY
|
|
Packit Service |
9646c7 |
build directive files and upload files by SFTP
|
|
Packit Service |
9646c7 |
[user@]host:DIRECTORY upload files with scp
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
Options and commands are applied in order. If the file $conffile exists
|
|
Packit Service |
9646c7 |
in the current working directory, its contents are prepended to the
|
|
Packit Service |
9646c7 |
actual command line options. Use this to keep your defaults. Comments
|
|
Packit Service |
9646c7 |
(#) and empty lines in $conffile are allowed.
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
Examples:
|
|
Packit Service |
9646c7 |
1. Upload foobar-1.0.tar.gz to ftp.gnu.org:
|
|
Packit Service |
9646c7 |
gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
2. Upload foobar-1.0.tar.gz and foobar-1.0.tar.xz to ftp.gnu.org:
|
|
Packit Service |
9646c7 |
gnupload --to ftp.gnu.org:foobar foobar-1.0.tar.gz foobar-1.0.tar.xz
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
3. Same as above, and also create symbolic links to foobar-latest.tar.*:
|
|
Packit Service |
9646c7 |
gnupload --to ftp.gnu.org:foobar \\
|
|
Packit Service |
9646c7 |
--symlink-regex \\
|
|
Packit Service |
9646c7 |
foobar-1.0.tar.gz foobar-1.0.tar.xz
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
4. Upload foobar-0.9.90.tar.gz to two sites:
|
|
Packit Service |
9646c7 |
gnupload --to alpha.gnu.org:foobar \\
|
|
Packit Service |
9646c7 |
--to sources.redhat.com:~ftp/pub/foobar \\
|
|
Packit Service |
9646c7 |
foobar-0.9.90.tar.gz
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
5. Delete oopsbar-0.9.91.tar.gz and upload foobar-0.9.91.tar.gz
|
|
Packit Service |
9646c7 |
(the -- terminates the list of files to delete):
|
|
Packit Service |
9646c7 |
gnupload --to alpha.gnu.org:foobar \\
|
|
Packit Service |
9646c7 |
--to sources.redhat.com:~ftp/pub/foobar \\
|
|
Packit Service |
9646c7 |
--delete oopsbar-0.9.91.tar.gz \\
|
|
Packit Service |
9646c7 |
-- foobar-0.9.91.tar.gz
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
gnupload uses the ncftpput program to do the transfers; if you don't
|
|
Packit Service |
9646c7 |
happen to have an ncftp package installed, the ncftpput-ftp script in
|
|
Packit Service |
9646c7 |
the build-aux/ directory of the gnulib package
|
|
Packit Service |
9646c7 |
(http://savannah.gnu.org/projects/gnulib) may serve as a replacement.
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
Send patches and bug reports to <bug-gnulib@gnu.org>."
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
# Read local configuration file
|
|
Packit Service |
9646c7 |
if test -r "$conffile"; then
|
|
Packit Service |
9646c7 |
echo "$0: Reading configuration file $conffile"
|
|
Packit Service |
9646c7 |
conf=`sed 's/#.*$//;/^$/d' "$conffile" | tr "\015$nl" ' '`
|
|
Packit Service |
9646c7 |
eval set x "$conf \"\$@\""
|
|
Packit Service |
9646c7 |
shift
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
while test -n "$1"; do
|
|
Packit Service |
9646c7 |
case $1 in
|
|
Packit Service |
9646c7 |
-*)
|
|
Packit Service |
9646c7 |
collect_var=
|
|
Packit Service |
9646c7 |
case $1 in
|
|
Packit Service |
9646c7 |
--help)
|
|
Packit Service |
9646c7 |
echo "$usage"
|
|
Packit Service |
9646c7 |
exit $?
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
--to)
|
|
Packit Service |
9646c7 |
if test -z "$2"; then
|
|
Packit Service |
9646c7 |
echo "$0: Missing argument for --to" 1>&2
|
|
Packit Service |
9646c7 |
exit 1
|
|
Packit Service |
9646c7 |
else
|
|
Packit Service |
9646c7 |
to="$to $2"
|
|
Packit Service |
9646c7 |
shift
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
--user)
|
|
Packit Service |
9646c7 |
if test -z "$2"; then
|
|
Packit Service |
9646c7 |
echo "$0: Missing argument for --user" 1>&2
|
|
Packit Service |
9646c7 |
exit 1
|
|
Packit Service |
9646c7 |
else
|
|
Packit Service |
9646c7 |
GPG="$GPG --local-user $2"
|
|
Packit Service |
9646c7 |
shift
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
--delete)
|
|
Packit Service |
9646c7 |
collect_var=delete_files
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
--rmsymlink)
|
|
Packit Service |
9646c7 |
collect_var=delete_symlinks
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
--symlink-regex=*)
|
|
Packit Service |
9646c7 |
symlink_expr=`expr "$1" : '[^=]*=\(.*\)'`
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
--symlink-regex)
|
|
Packit Service |
9646c7 |
symlink_expr='s|-[0-9][0-9\.]*\(-[0-9][0-9]*\)\{0,1\}\.|-latest.|'
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
--symlink)
|
|
Packit Service |
9646c7 |
collect_var=symlink_files
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
--dry-run|-n)
|
|
Packit Service |
9646c7 |
dry_run=:
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
--version)
|
|
Packit Service |
9646c7 |
echo "gnupload $scriptversion"
|
|
Packit Service |
9646c7 |
exit $?
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
--)
|
|
Packit Service |
9646c7 |
shift
|
|
Packit Service |
9646c7 |
break
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
-*)
|
|
Packit Service |
9646c7 |
echo "$0: Unknown option '$1', try '$0 --help'" 1>&2
|
|
Packit Service |
9646c7 |
exit 1
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
esac
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
*)
|
|
Packit Service |
9646c7 |
if test -z "$collect_var"; then
|
|
Packit Service |
9646c7 |
break
|
|
Packit Service |
9646c7 |
else
|
|
Packit Service |
9646c7 |
eval "$collect_var=\"\$$collect_var $1\""
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
esac
|
|
Packit Service |
9646c7 |
shift
|
|
Packit Service |
9646c7 |
done
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
dprint()
|
|
Packit Service |
9646c7 |
{
|
|
Packit Service |
9646c7 |
echo "Running $* ..."
|
|
Packit Service |
9646c7 |
}
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
if $dry_run; then
|
|
Packit Service |
9646c7 |
dbg=dprint
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
if test -z "$to"; then
|
|
Packit Service |
9646c7 |
echo "$0: Missing destination sites" >&2
|
|
Packit Service |
9646c7 |
exit 1
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
if test -n "$symlink_files"; then
|
|
Packit Service |
9646c7 |
x=`echo "$symlink_files" | sed 's/[^ ]//g;s/ //g'`
|
|
Packit Service |
9646c7 |
if test -n "$x"; then
|
|
Packit Service |
9646c7 |
echo "$0: Odd number of symlink arguments" >&2
|
|
Packit Service |
9646c7 |
exit 1
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
if test $# = 0; then
|
|
Packit Service |
9646c7 |
if test -z "${symlink_files}${delete_files}${delete_symlinks}"; then
|
|
Packit Service |
9646c7 |
echo "$0: No file to upload" 1>&2
|
|
Packit Service |
9646c7 |
exit 1
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
else
|
|
Packit Service |
9646c7 |
# Make sure all files exist. We don't want to ask
|
|
Packit Service |
9646c7 |
# for the passphrase if the script will fail.
|
|
Packit Service |
9646c7 |
for file
|
|
Packit Service |
9646c7 |
do
|
|
Packit Service |
9646c7 |
if test ! -f $file; then
|
|
Packit Service |
9646c7 |
echo "$0: Cannot find '$file'" 1>&2
|
|
Packit Service |
9646c7 |
exit 1
|
|
Packit Service |
9646c7 |
elif test -n "$symlink_expr"; then
|
|
Packit Service |
9646c7 |
linkname=`echo $file | sed "$symlink_expr"`
|
|
Packit Service |
9646c7 |
if test -z "$linkname"; then
|
|
Packit Service |
9646c7 |
echo "$0: symlink expression produces empty results" >&2
|
|
Packit Service |
9646c7 |
exit 1
|
|
Packit Service |
9646c7 |
elif test "$linkname" = $file; then
|
|
Packit Service |
9646c7 |
echo "$0: symlink expression does not alter file name" >&2
|
|
Packit Service |
9646c7 |
exit 1
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
done
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
# Make sure passphrase is not exported in the environment.
|
|
Packit Service |
9646c7 |
unset passphrase
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
# Reset PATH to be sure that echo is a built-in. We will later use
|
|
Packit Service |
9646c7 |
# 'echo $passphrase' to output the passphrase, so it is important that
|
|
Packit Service |
9646c7 |
# it is a built-in (third-party programs tend to appear in 'ps'
|
|
Packit Service |
9646c7 |
# listings with their arguments...).
|
|
Packit Service |
9646c7 |
# Remember this script runs with 'set -e', so if echo is not built-in
|
|
Packit Service |
9646c7 |
# it will exit now.
|
|
Packit Service |
9646c7 |
PATH=/empty echo -n "Enter GPG passphrase: "
|
|
Packit Service |
9646c7 |
stty -echo
|
|
Packit Service |
9646c7 |
read -r passphrase
|
|
Packit Service |
9646c7 |
stty echo
|
|
Packit Service |
9646c7 |
echo
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
if test $# -ne 0; then
|
|
Packit Service |
9646c7 |
for file
|
|
Packit Service |
9646c7 |
do
|
|
Packit Service |
9646c7 |
echo "Signing $file ..."
|
|
Packit Service |
9646c7 |
rm -f $file.sig
|
|
Packit Service |
9646c7 |
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 -ba -o $file.sig $file
|
|
Packit Service |
9646c7 |
done
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
# mkdirective DESTDIR BASE FILE STMT
|
|
Packit Service |
9646c7 |
# Arguments: See upload, below
|
|
Packit Service |
9646c7 |
mkdirective ()
|
|
Packit Service |
9646c7 |
{
|
|
Packit Service |
9646c7 |
stmt="$4"
|
|
Packit Service |
9646c7 |
if test -n "$3"; then
|
|
Packit Service |
9646c7 |
stmt="
|
|
Packit Service |
9646c7 |
filename: $3$stmt"
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
cat >${2}.directive<
|
|
Packit Service |
9646c7 |
version: 1.1
|
|
Packit Service |
9646c7 |
directory: $1
|
|
Packit Service |
9646c7 |
comment: gnupload v. $scriptversion$stmt
|
|
Packit Service |
9646c7 |
EOF
|
|
Packit Service |
9646c7 |
if $dry_run; then
|
|
Packit Service |
9646c7 |
echo "File ${2}.directive:"
|
|
Packit Service |
9646c7 |
cat ${2}.directive
|
|
Packit Service |
9646c7 |
echo "File ${2}.directive:" | sed 's/./-/g'
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
}
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
mksymlink ()
|
|
Packit Service |
9646c7 |
{
|
|
Packit Service |
9646c7 |
while test $# -ne 0
|
|
Packit Service |
9646c7 |
do
|
|
Packit Service |
9646c7 |
echo "symlink: $1 $2"
|
|
Packit Service |
9646c7 |
shift
|
|
Packit Service |
9646c7 |
shift
|
|
Packit Service |
9646c7 |
done
|
|
Packit Service |
9646c7 |
}
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
# upload DEST DESTDIR BASE FILE STMT FILES
|
|
Packit Service |
9646c7 |
# Arguments:
|
|
Packit Service |
9646c7 |
# DEST Destination site;
|
|
Packit Service |
9646c7 |
# DESTDIR Destination directory;
|
|
Packit Service |
9646c7 |
# BASE Base name for the directive file;
|
|
Packit Service |
9646c7 |
# FILE Name of the file to distribute (may be empty);
|
|
Packit Service |
9646c7 |
# STMT Additional statements for the directive file;
|
|
Packit Service |
9646c7 |
# FILES List of files to upload.
|
|
Packit Service |
9646c7 |
upload ()
|
|
Packit Service |
9646c7 |
{
|
|
Packit Service |
9646c7 |
dest=$1
|
|
Packit Service |
9646c7 |
destdir=$2
|
|
Packit Service |
9646c7 |
base=$3
|
|
Packit Service |
9646c7 |
file=$4
|
|
Packit Service |
9646c7 |
stmt=$5
|
|
Packit Service |
9646c7 |
files=$6
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
rm -f $base.directive $base.directive.asc
|
|
Packit Service |
9646c7 |
case $dest in
|
|
Packit Service |
9646c7 |
alpha.gnu.org:*)
|
|
Packit Service |
9646c7 |
mkdirective "$destdir" "$base" "$file" "$stmt"
|
|
Packit Service |
9646c7 |
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive
|
|
Packit Service |
9646c7 |
$dbg ncftpput ftp-upload.gnu.org /incoming/alpha $files $base.directive.asc
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
ftp.gnu.org:*)
|
|
Packit Service |
9646c7 |
mkdirective "$destdir" "$base" "$file" "$stmt"
|
|
Packit Service |
9646c7 |
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive
|
|
Packit Service |
9646c7 |
$dbg ncftpput ftp-upload.gnu.org /incoming/ftp $files $base.directive.asc
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
savannah.gnu.org:*)
|
|
Packit Service |
9646c7 |
if test -z "$files"; then
|
|
Packit Service |
9646c7 |
echo "$0: warning: standalone directives not applicable for $dest" >&2
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
$dbg ncftpput savannah.gnu.org /incoming/savannah/$destdir $files
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
savannah.nongnu.org:*)
|
|
Packit Service |
9646c7 |
if test -z "$files"; then
|
|
Packit Service |
9646c7 |
echo "$0: warning: standalone directives not applicable for $dest" >&2
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
$dbg ncftpput savannah.nongnu.org /incoming/savannah/$destdir $files
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
download.gnu.org.ua:alpha/*|download.gnu.org.ua:ftp/*)
|
|
Packit Service |
9646c7 |
destdir_p1=`echo "$destdir" | sed 's,^[^/]*/,,'`
|
|
Packit Service |
9646c7 |
destdir_topdir=`echo "$destdir" | sed 's,/.*,,'`
|
|
Packit Service |
9646c7 |
mkdirective "$destdir_p1" "$base" "$file" "$stmt"
|
|
Packit Service |
9646c7 |
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive
|
|
Packit Service |
9646c7 |
for f in $files $base.directive.asc
|
|
Packit Service |
9646c7 |
do
|
|
Packit Service |
9646c7 |
echo put $f
|
|
Packit Service |
9646c7 |
done | $dbg sftp -b - puszcza.gnu.org.ua:/incoming/$destdir_topdir
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
/*)
|
|
Packit Service |
9646c7 |
dest_host=`echo "$dest" | sed 's,:.*,,'`
|
|
Packit Service |
9646c7 |
mkdirective "$destdir" "$base" "$file" "$stmt"
|
|
Packit Service |
9646c7 |
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive
|
|
Packit Service |
9646c7 |
$dbg cp $files $base.directive.asc $dest_host
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
*)
|
|
Packit Service |
9646c7 |
if test -z "$files"; then
|
|
Packit Service |
9646c7 |
echo "$0: warning: standalone directives not applicable for $dest" >&2
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
$dbg scp $files $dest
|
|
Packit Service |
9646c7 |
;;
|
|
Packit Service |
9646c7 |
esac
|
|
Packit Service |
9646c7 |
rm -f $base.directive $base.directive.asc
|
|
Packit Service |
9646c7 |
}
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
#####
|
|
Packit Service |
9646c7 |
# Process any standalone directives
|
|
Packit Service |
9646c7 |
stmt=
|
|
Packit Service |
9646c7 |
if test -n "$symlink_files"; then
|
|
Packit Service |
9646c7 |
stmt="$stmt
|
|
Packit Service |
9646c7 |
`mksymlink $symlink_files`"
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
for file in $delete_files
|
|
Packit Service |
9646c7 |
do
|
|
Packit Service |
9646c7 |
stmt="$stmt
|
|
Packit Service |
9646c7 |
archive: $file"
|
|
Packit Service |
9646c7 |
done
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
for file in $delete_symlinks
|
|
Packit Service |
9646c7 |
do
|
|
Packit Service |
9646c7 |
stmt="$stmt
|
|
Packit Service |
9646c7 |
rmsymlink: $file"
|
|
Packit Service |
9646c7 |
done
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
if test -n "$stmt"; then
|
|
Packit Service |
9646c7 |
for dest in $to
|
|
Packit Service |
9646c7 |
do
|
|
Packit Service |
9646c7 |
destdir=`echo $dest | sed 's/[^:]*://'`
|
|
Packit Service |
9646c7 |
upload "$dest" "$destdir" "`hostname`-$$" "" "$stmt"
|
|
Packit Service |
9646c7 |
done
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
# Process actual uploads
|
|
Packit Service |
9646c7 |
for dest in $to
|
|
Packit Service |
9646c7 |
do
|
|
Packit Service |
9646c7 |
for file
|
|
Packit Service |
9646c7 |
do
|
|
Packit Service |
9646c7 |
echo "Uploading $file to $dest ..."
|
|
Packit Service |
9646c7 |
stmt=
|
|
Packit Service |
9646c7 |
files="$file $file.sig"
|
|
Packit Service |
9646c7 |
destdir=`echo $dest | sed 's/[^:]*://'`
|
|
Packit Service |
9646c7 |
if test -n "$symlink_expr"; then
|
|
Packit Service |
9646c7 |
linkname=`echo $file | sed "$symlink_expr"`
|
|
Packit Service |
9646c7 |
stmt="$stmt
|
|
Packit Service |
9646c7 |
symlink: $file $linkname
|
|
Packit Service |
9646c7 |
symlink: $file.sig $linkname.sig"
|
|
Packit Service |
9646c7 |
fi
|
|
Packit Service |
9646c7 |
upload "$dest" "$destdir" "$file" "$file" "$stmt" "$files"
|
|
Packit Service |
9646c7 |
done
|
|
Packit Service |
9646c7 |
done
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
exit 0
|
|
Packit Service |
9646c7 |
|
|
Packit Service |
9646c7 |
# Local variables:
|
|
Packit Service |
9646c7 |
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
|
Packit Service |
9646c7 |
# time-stamp-start: "scriptversion="
|
|
Packit Service |
9646c7 |
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
Packit Service |
9646c7 |
# time-stamp-time-zone: "UTC"
|
|
Packit Service |
9646c7 |
# time-stamp-end: "; # UTC"
|
|
Packit Service |
9646c7 |
# End:
|