summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2017-02-02 19:54:23 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2017-02-02 19:54:23 +0000
commit4d2f31231fb298fd5967a8a75d83e587aa8ade61 (patch)
treea54da2ce8cb399846ca3868325d0c5f852929032
parent614d76da5beedff2e2ef732e35a77d9875c566a6 (diff)
nodename2hostname.sh: Make NODE_NAME the only and mandatory parameter.
And don't rely on the environment variable. Change-Id: I9b14f0b11c44a6a670d065e8ac61e3f2a16847e3
-rwxr-xr-xnodename2hostname.sh22
1 files changed, 12 insertions, 10 deletions
diff --git a/nodename2hostname.sh b/nodename2hostname.sh
index 6f401715..22a33441 100755
--- a/nodename2hostname.sh
+++ b/nodename2hostname.sh
@@ -9,27 +9,29 @@
# FIXME: try to get rid of this script, it's going to be a maintenance
# nightmare :-)
-ID=$(echo ${NODE_NAME} | sed 's/.*-\([0-9][0-9]\)$/\1/')
+NODE=$1
+if [ x"$NODE" = x ]; then
+ echo "Usage: $0 node-name"
+ exit 1
+fi
+
+ID=$(echo ${NODE} | sed 's/.*-\([0-9][0-9]\)$/\1/')
NAME=
-case ${NODE_NAME} in
+case ${NODE} in
tcwg-aarch64-build-0[1-2]) NAME=apm-${ID} ;;
tcwg-aarch64-test-0[1-2]) NAME=test-armv8-${ID} ;;
tcwg-bmk-tk1-0[6-8]) NAME=build-${ID} ;;
tcwg-bmk-tx1-0[6-8]) NAME=build-${ID} ;;
- tcwg-tk1-0[1-5]) NAME=${NODE_NAME} ;;
- tcwg-tx1-0[1-5]) NAME=${NODE_NAME} ;;
+ tcwg-tk1-0[1-5]) NAME=${NODE} ;;
+ tcwg-tx1-0[1-5]) NAME=${NODE} ;;
tcwg-x86_64-build-0[1-8]) NAME=build-${ID} ;;
tcwg-x86_64-dev-0[1-2]) NAME=dev-${ID} ;;
tcwg-x86_64-dev-0[1-2]-short)
- ID=$(echo ${NODE_NAME} | sed 's/.*-\([0-9][0-9]\)-short$/\1/')
+ ID=$(echo ${NODE} | sed 's/.*-\([0-9][0-9]\)-short$/\1/')
NAME=dev-${ID}
;;
- "")
- echo "Error: NODE_NAME is not defined." 1>&2
- exit 1
- ;;
*)
- echo "Error: unsupported NODE_NAME value: ${NODE_NAME}" 1>&2
+ echo "Error: unsupported NODE value: ${NODE}" 1>&2
exit 1
;;
esac