#!/bin/bash
-
-# @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
+# SPDX-License-Identifier: EPL-1.0
##############################################################################
# Copyright (c) 2016 The Linux Foundation and others.
#
# http://www.eclipse.org/legal/epl-v10.html
##############################################################################
-HOST=$(/usr/bin/hostname)
+HOST=$(/bin/hostname)
SYSTEM_TYPE=''
-# We use a separator character of - for the slave parts
-IFS='-' read -r -a HOSTPARTS <<< "${HOST}"
-
-# slurp in the control scripts
-FILES=($(find . -maxdepth 1 -type f -iname '*.sh' -exec basename -s '.sh' {} \;))
-# remap into an associative array
-declare -A A_FILES
-for key in "${!FILES[@]}"
-do
- A_FILES[${FILES[$key]}]="${key}"
-done
-
-# Find our system_type control script if possible
-for i in "${HOSTPARTS[@]}"
-do
- if [ "${A_FILES[${i}]}" != "" ]
- then
- SYSTEM_TYPE=${i}
+IFS=','
+for i in "java-builder,builder" \
+ "builder,builder" \
+ "devstack,devstack" \
+ "docker,docker" \
+ "gbp,ubuntu-docker-ovs" \
+ "kubernetes,mininet-ubuntu" \
+ "robot,robot" \
+ "mininet,mininet-ubuntu"
+do set -- $i
+ if [[ $HOST == *"$1"* ]]; then
+ SYSTEM_TYPE="$2"
break
fi
done