#!/bin/sh
#set -e

. $KUMATUXBIN/kumatux.org-vars

KUMATUX_RUBYLIB_ESCAPED=`$KUMATUXBIN/kumatux.org-sed-escape $KUMATUX_RUBYLIB`
if [ "$KUMATUX_RUBYLIB_ESCAPED" ]
then
    SYSTEM_RUBYLIB=`echo $RUBYLIB | sed "s/$KUMATUX_RUBYLIB_ESCAPED//" | sed 's/:$//'`
else
    SYSTEM_RUBYLIB=$RUBYLIB
fi

export KUMATUX_RUBYLIB=`cat $KUMATUXETC/$KUMATUXETCRUBYLIB/*.conf 2>/dev/null | sed 's/:$//'`

if [ "$KUMATUX_RUBYLIB" ]
then
    if [ "$SYSTEM_RUBYLIB" ]
    then
	export RUBYLIB="$KUMATUX_RUBYLIB:$SYSTEM_RUBYLIB"
    else
	export RUBYLIB=$KUMATUX_RUBYLIB
    fi
else
    export RUBYLIB=$SYSTEM_RUBYLIB
fi
