Detect and fail on direct call to select_version
Change-Id: Ib8cf28eb75c2d03a5fd2138d560ea75f35a39eb8
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/bin/select_version b/bin/select_version
index 917c545..0eb8f47 100755
--- a/bin/select_version
+++ b/bin/select_version
@@ -57,6 +57,14 @@
base_program_path=$(readlink -f "${0}")
base_program_name=${base_program_path##*/}
+ if [ "${program_name}" == "${base_program_name}" ] ; then
+ {
+ echo -n "**ERROR** ${base_program_name} should never be called directly."
+ echo " Only links to ${base_program_name} should be called."
+ } >&2
+ exit 1
+ fi
+
# Compose the version_var_name value (e.g. PYTHON_VERSION).
version_var_name=${program_uppercase_name}_VERSION
# Compose the alternate_program_name (e.g. python3).