3 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
4 ##############################################################################
5 # Copyright (c) 2016 The Linux Foundation and others.
7 # All rights reserved. This program and the accompanying materials
8 # are made available under the terms of the Eclipse Public License v1.0
9 # which accompanies this distribution, and is available at
10 # http://www.eclipse.org/legal/epl-v10.html
11 ##############################################################################
13 HOST=$(/usr/bin/hostname)
16 # We use a separator character of - for the slave parts
17 IFS='-' read -r -a HOSTPARTS <<< "${HOST}"
19 # slurp in the control scripts
20 FILES=($(find . -maxdepth 1 -type f -iname '*.sh' -exec basename -s '.sh' {} \;))
21 # remap into an associative array
23 for key in "${!FILES[@]}"
25 A_FILES[${FILES[$key]}]="${key}"
28 # Find our system_type control script if possible
29 for i in "${HOSTPARTS[@]}"
31 if [ "${A_FILES[${i}]}" != "" ]
38 # Write out the system type to an environment file to then be sourced
39 echo "SYSTEM_TYPE=${SYSTEM_TYPE}" > /tmp/system_type.sh
41 # vim: sw=4 ts=4 sts=4 et :