summaryrefslogtreecommitdiffstats
path: root/jenkins-scripts/system_type.sh
blob: c3083ae283d0912ccb6f36997a41a634fcd779ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

# @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
##############################################################################
# Copyright (c) 2016 The Linux Foundation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
##############################################################################

HOST=$(/bin/hostname)
SYSTEM_TYPE=''

IFS=','
for i in "basebuild,basebuild" \
         "centos,centos" \
         "ubuntu1404,ubuntu1404" \
         "ubuntu1604,ubuntu1604" \
         "opensuse,opensuse"
do set -- $i
    if [[ $HOST == *"$1"* ]]; then
        SYSTEM_TYPE="$2"
        break
    fi
done

# Write out the system type to an environment file to then be sourced
echo "SYSTEM_TYPE=${SYSTEM_TYPE}" > /tmp/system_type.sh

# vim: sw=4 ts=4 sts=4 et :