Skip to content

Apache Lucene open-source search software

SOLR-5085: the point of the subdir is so the files wouldn't have 'rc' in their name, and could be copied as is ... fix script to split X.Y-RCZ to build final file names, and vet that args look correct

Chris M. Hostetter13111f8435f1
diff --git a/dev-tools/scripts/prep-solr-ref-guide-rc.sh b/dev-tools/scripts/prep-solr-ref-guide-rc.sh
index 4c16091de0c..66a0e443edd 100755
--- a/dev-tools/scripts/prep-solr-ref-guide-rc.sh
+++ b/dev-tools/scripts/prep-solr-ref-guide-rc.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -36,10 +36,28 @@ if [ $# -lt 2 ] || [ 3 -lt $# ] ; then
exit 1;
fi
-PREFIX="apache-solr-ref-guide"
SRC_FILE=$1
-DIR="$PREFIX-$2"
-PDF="$DIR/$PREFIX-$2.pdf"
+VER_RC=$2
+GPG_ID_ARG=""
+if [ ! -z "$3" ] ; then
+ GPG_ID_ARG="-u $3"
+fi
+
+VER_RC_PARTS=( ${VER_RC//-/ } )
+if [ 2 -ne ${#VER_RC_PARTS[@]} ] ; then
+ echo "! ! ! Can't proceed, Version+RC suffix must have one '-' (ie: X.Y-RCZ) : $VER_RC"
+ exit 1;
+fi
+VER=${VER_RC_PARTS[0]}
+VER_PARTS=( ${VER//./ } )
+if [ 2 -ne ${#VER_PARTS[@]} ] ; then
+ echo "! ! ! Can't proceed, Version must have one '.' (ie: X.Y) : $VER"
+ exit 1;
+fi
+
+PREFIX="apache-solr-ref-guide"
+DIR="$PREFIX-$VER_RC"
+PDF="$DIR/$PREFIX-$VER.pdf"
SHA="$PDF.sha1"
GPG="$PDF.asc"
@@ -53,11 +71,6 @@ if [ -d $DIR ] ; then
exit 1;
fi
-GPG_ID_ARG=""
-if [ ! -z "$3" ] ; then
- GPG_ID_ARG="-u $3"
-fi
-
# from here on, use set -x to echo progress and rely on decent error messages
# from shell commands that might fail.