Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Mar 2006 14:39:17 +0200
From:      "Frans Haarman" <franshaarman@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   rcng, addition to rc.subr
Message-ID:  <b039b5c70603310439m18ee824ev6a65a26a59dfcacd@mail.gmail.com>

index | next in thread | raw e-mail

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


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b039b5c70603310439m18ee824ev6a65a26a59dfcacd>