From 80131905c412c290df086c59d5671d3bfed7f6e5 Mon Sep 17 00:00:00 2001 From: pgueth Date: Thu, 3 Mar 2011 18:08:46 +0100 Subject: [PATCH] more grid scripts --- grid/upload_release.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 grid/upload_release.sh diff --git a/grid/upload_release.sh b/grid/upload_release.sh new file mode 100755 index 0000000..5b55822 --- /dev/null +++ b/grid/upload_release.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +set -u + +# print error message and exit immediately +programname="$(basename ${0})" +function error { +echo "${programname} **ERROR** $1" +exit 1 +} + +# ensure a valid proxy is present for at least one hour +# if no proxy is found, try to create a new one +# return 0 if a valid proxy is found or created +# else return voms-proxy-init error code +function ensure_proxy { +voms-proxy-info --exists -valid 1:0 > /dev/null && return 0 +voms-proxy-init --voms biomed -valid 24:00 || exit 1 +} + +# print prompt to ensure that the user want to continue further +# the user has to answer with 'y' to continue +function check_user { +prompt="${1:-is that correct?}" +read -p "${prompt} [y/n] " answer +test "${answer}" == "y" && return 0 +test "${answer}" == "n" && return 1 +check_user "${prompt}" +} + + +releaselfndir="/grid/biomed/creatis/fgate/releases/" +prefix="${USER:?"USER must be set"}_" +releasearchive=${1:?"provide path to release archive"} +targetreleasearchive="${prefix}$(basename "${releasearchive}")" + +ensure_proxy || error "no valid proxy" + +echo "targetreleasearchive=${targetreleasearchive}" +echo "releaselfndir=${releaselfndir}" +check_user || error "user doesn't agree" + -- 2.47.1