From 86ba0d3980a52a29bc19887de661fee9403378ba Mon Sep 17 00:00:00 2001 From: mrenzmann Date: Thu, 31 Jul 2008 05:48:07 +0000 Subject: [PATCH] Improve checks for directories used during release process. git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3829 0192ed92-7a03-0410-a25b-9323aeb14dbd --- scripts/make-release.bash | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/scripts/make-release.bash b/scripts/make-release.bash index 33adef0..b6e65d5 100755 --- a/scripts/make-release.bash +++ b/scripts/make-release.bash @@ -3,6 +3,27 @@ # Purpose: automate the process of tagging a release and packing a tarball # for it. +# check_dir_prereq: +# ensures that a given directory name exist and is writeable +# note: $1 is expected to be set to the name of the variable that contains +# the name of the directory that is to be tested (indirect reference) +function check_dir_prereq { + eval d="\$$1" + n="$1" + + if [[ ! -d "$d" || ! -w "$d" ]]; then + echo + echo "ERROR:" + echo -n "$n, currently set to $d, " + [[ ! -d "$d" ]] && echo "does not exist" || echo "is not writable" + echo + exit 1 + fi +} + + + + # check if the script has been called directly if [[ "$(basename $(pwd))" == "scripts" ]]; then echo @@ -23,6 +44,11 @@ if [[ "$RELEASE_TMP" == "" || "$RELEASE_STORE" == "" ]]; then exit 1 fi +# make sure that the directories passed in RELEASE_TMP and RELEASE_STORE +# actually exist and are writable for the caller +check_dir_prereq "RELEASE_TMP" +check_dir_prereq "RELEASE_STORE" + # caller must have write access to the madwifi.org repository valid=0 repos=$(svn info | grep "Repository Root" | cut -d" " -f3) @@ -48,14 +74,6 @@ if [[ "$valid" != "1" ]]; then fi -if [[ ! -d "$RELEASE_TMP" ]]; then - echo - echo "ERROR:" - echo "RELEASE_TMP seems to be wrong. $RELEASE_TMP: no such directory" - echo - exit 1 -fi - # check if we're in the top-level directory of the snapshot if [[ ! -f ./release.h ]]; then echo -- 2.35.1