#!/bin/bash
#
# jtconf wrapper for toolkit __TOOLKIT__
#
export TOOLKIT="__TOOLKIT__"
export PRJNAME="$TOOLKIT"
export CONFDIR="/etc/$TOOLKIT"

# set distro env vars
export DISTRIB_ID DISTRIB_RELEASE DISTRIB_CODENAME DISTRIB_DESCRIPTION DISTRIB_FULL_ID
export DISTRIB_HAS_UPSTART DISTRIB_HAS_APPARMOR
export DISTRIB_HAS_SYSTEMD DISTRIB_USES_SYSTEMD
eval $(ku-distroenv)


[ X"$1" == "X--noparse" ] && {
	shift
	exec jtconf --noparse "$@"
}

# returns status of last failed pipeline command (ie: jtconf)
# not just the last command in the pipeline
set -o pipefail
jtconf "$@" | kusa-conf-parse -
exit $?
