#!/bin/sh # -*- mode: sh; tab-width: 8; coding: utf-8-unix -*- prog=$( basename $0 .bash ) PREFIX=/var/local ROLE=base . /usr/local/etc/testforge/testforge.bash || exit 1 . /usr/local/bin/usr_local_base.bash || exit 2 [ -n "$TESTFORGE_ANSIBLE_SRC" ] || TESTFORGE_ANSIBLE_SRC=/g/TestForge/src/ansible if [ -d "$TESTFORGE_ANSIBLE_SRC" ] ; then base=`cat /etc/hostname` json="$TESTFORGE_ANSIBLE_SRC"/tmp/Hosts/$base.json if [ ! -s $json ] || [ "$TESTFORGE_ANSIBLE_SRC"/hosts.yml -nt $json ] ; then ansible-inventory --playbook-dir $TESTFORGE_ANSIBLE_SRC -i $TESTFORGE_ANSIBLE_SRC/hosts.yml \ --host=$base > $json || exit 1$? fi eval export BOX_OS_FLAVOR=`jq .BOX_OS_FLAVOR < $json` DBUG BOX_OS_FLAVOR=$BOX_OS_FLAVOR fi # 2>/dev/null [ -z "$BOX_OS_FLAVOR" ] && ERROR BOX_OS_FLAVOR not set && exit 1 [ "$BOX_OS_FLAVOR" = Ubuntu16 ] && ERROR BOX_OS_FLAVOR = Ubuntu16 && exit 2 [ "$BOX_OS_FLAVOR" = Devuan4 ] && ERROR BOX_OS_FLAVOR = Devuan4 && exit 2 echo $BOX_OS_FLAVOR exit 0