Menu

[r1153]: / trunk / etc / configxml.subr  Maximize  Restore  History

Download this file

46 lines (39 with data), 843 Bytes

# Copyright © 2007 Volker Theile (votdev@gmx.de)
# All rights reserved.
#
# configxml.subr
#	functions used by various rc scripts
#

configxml_file=${configxml_file:-"/conf/config.xml"}

#
# configxml_isset xpath
#	Check in /conf/config.xml if xpath is available/found.
#	Return 0 if set, nonzero otherwise.
#	$1 - XPATH expression
#
configxml_isset()
{
	local _result

	_result=`/usr/local/bin/xml sel -t -v "count($1)" ${configxml_file}`
	if [ 0 -eq ${_result} ]; then
		return 1
	else
		return 0
	fi
}

#
# configxml_set_rcvar xpath
#	Set ${rcvar} depending on whether XPATH expression evaluates true.
#	$1 - XPATH expression
#
configxml_set_rcvar()
{
	local _value

	if configxml_isset $1; then
		eval ${rcvar}=YES
	else
		eval ${rcvar}=NO
	fi

	eval _value=\$${rcvar}
	debug "configxml_setrcvar: ${rcvar} has been changed to $_value."
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.