diff options
author | Claudio Fontana <sick_soul@users.sourceforge.net> | 2006-07-21 23:13:05 +0000 |
---|---|---|
committer | Claudio Fontana <sick_soul@users.sourceforge.net> | 2006-07-21 23:13:05 +0000 |
commit | 1998267a890ac27651595c26f190997b002548ff (patch) | |
tree | dbfc6b1bdd401797170266502105e79f9609d7d4 | |
parent | bc22284e4e81a274b7b7db2905da58a0101a63fb (diff) | |
download | idutils-1998267a890ac27651595c26f190997b002548ff.tar.gz idutils-1998267a890ac27651595c26f190997b002548ff.tar.bz2 idutils-1998267a890ac27651595c26f190997b002548ff.zip |
add general version of distribute.sh
-rwxr-xr-x | distribute.sh | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/distribute.sh b/distribute.sh new file mode 100755 index 0000000..e98ad24 --- /dev/null +++ b/distribute.sh @@ -0,0 +1,103 @@ +#! /bin/sh + +if test $# -lt 1 ; then + echo "Usage: ./distribute.sh [OPTIONS] DIRECTORY PACKAGE" + echo " " + echo "OPTIONS:" + echo "-uHOSTNAME choose upload hostname (def:ftp-upload.gnu.org)" + echo "-hHOSTNAME choose the destination hostname [ftp|alpha] (def:ftp)" + echo "-cCOMMENT add a comment to the upload directive" + echo " " + echo "DIRECTORY: the destination directory on the remote host" + echo "PACKAGE: the tarball file to distribute" + echo " " + exit 1 +fi + +UPLOAD_HOST=ftp-upload.gnu.org +DESTINATION_HOST=ftp +COMMENT= +DIRECTORY= +PACKAGE= + +processing_options=1 + +for ARG in "$@" ; do + if test $processing_options = 1 ; then + case $ARG in + -u*) + UPLOAD_HOST="${ARG#-u}" + echo UPLOAD_HOST=${UPLOAD_HOST} + continue + ;; + -h*) + DESTINATION_HOST="${ARG#-h}" + echo DESTINATION_HOST=${DESTINATION_HOST} + continue + ;; + -c*) + COMMENT="${ARG#-c}" + echo COMMENT=${COMMENT} + continue + ;; + -*) + echo "unknown option: $ARG" >&2 + exit 1 + esac + fi + + processing_options=0 + + if test "x$DIRECTORY" = "x" ; then + DIRECTORY="${ARG}" + echo DIRECTORY=${DIRECTORY} + continue; + fi + + if test "x$PACKAGE" = "x" ; then + PACKAGE="${ARG}" + echo PACKAGE=${PACKAGE} + continue; + fi + + echo "too many arguments: $ARG" >&2 + exit 1 +done + +if test "x$DIRECTORY" = "x" ; then + echo "missing required DIRECTORY argument" >&2 + exit 1 +fi + +if test "x$PACKAGE" = "x" ; then + echo "missing required PACKAGE argument" >&2 + exit 1 +fi + +if test -f "$PACKAGE" ; then + echo "${PACKAGE} is a regular file." +else + echo "${PACKAGE} is not an existing regular file" >&2 + exit 1 +fi + +gpg -b --yes ${PACKAGE} + +echo "version: 1.1" > ${PACKAGE}.directive +echo "directory: ${DIRECTORY}" >> ${PACKAGE}.directive +echo "filename: ${PACKAGE}" >> ${PACKAGE}.directive + +if test "x$COMMENT" != "x" ; then + echo "comment: ${COMMENT}" >> ${PACKAGE}.directive +fi + +gpg --clearsign --yes ${PACKAGE}.directive + +#upload results to ftp. +cmdftp ${UPLOAD_HOST}<<EOF +cd /incoming/${DESTINATION_HOST} +u ${PACKAGE} . +u ${PACKAGE}.sig . +u ${PACKAGE}.directive.asc . +exit +EOF |