FreeNAS Code
This project has moved to github - see https://github.com/freenas
Brought to you by:
cochard,
mattolander
# 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." }