rcng, addition to rc.subr

Frans Haarman franshaarman at gmail.com
Fri Mar 31 12:39:19 UTC 2006


I am changing /etc/rc.subr. I can now use rc.env.d directories. Each file in the
directory becomes a variable. somewhat like daemontools envdir. It
seemed nice to
include it to rcng.

So with this we can do:

echo 'yes' > rc.env.d/sshd/sshd_enable

Am concidering adding the "$_command'
name to the variables if there is no _ in the file name.

Then we could do:

echo yes > rc.env.d/sshd/enable


Here is the script:

#custom rc.env.d
#used to overide/configure last variables using rc.env.d

if [ -d /data/etc/rc.env.d/"$_command" ]; then

	debug "rc.env.d /data/etc/rc.env.d/${_command}"
	envd_vars=`ls /data/etc/rc.env.d/"${_command}"`	#each file is a var
	for envd_file in $envd_vars
	do
		if [ -f /data/etc/rc.env.d/"$_command"/$envd_file ]; then
		  export $envd_file=`head -1 /data/etc/rc.env.d/${_command}"/$envd_file`
		fi
	done

	#echo "rc.env.d /data/etc/rc.env.d/${_command}"
fi


Does this look ok to you ?

Regards,
Frans


More information about the freebsd-questions mailing list