Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 01 Feb 2011 15:28:50 +0100
From:      Damien Fleuriot <ml@my.gd>
To:        freebsd-stable@freebsd.org
Subject:   Re: Is /etc/rc.conf scriptable?
Message-ID:  <4D4818A2.9030901@my.gd>
In-Reply-To: <20110201123506.GA97242@fbsd.t60.cpu>
References:  <20110201123506.GA97242@fbsd.t60.cpu>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2/1/11 1:35 PM, Yue Wu wrote:
> Hi list,
> 
> I'm trying to do something to make rc.conf can act conditionally
> 
> What I want is:
> 
> 1. List the wireless access points,
> 
> grep if there is one which bssid is 'bb:bb:bb:bb:bb:bb',
> 
> if there is, then set ifconfig_wlan0 to the value:
> 
>     "inet 192.168.1.111 netmask 255.255.255.0 WPA"
> 
> 2. check if bitlbee has been installed, if so, then let bitlbee
> service start.
> 
> 
> So I tried with following settings in rc.conf, but all of them failed,
> i.e., the networking can't be connected and bitlbee service doesn't
> run.
> 
> /etc/rc.conf
> 
> if ifconfig wlan0 list scan 2>/dev/null | grep -q 'bb:bb:bb:bb:bb:bb' >/dev/null 2>&1; then
>     ifconfig_wlan0="inet 192.168.1.111 netmask 255.255.255.0 WPA"
> fi
> if [ -x /usr/local/sbin/bitlbee ]; then
>     bitlbee_enable="YES"
> fi
> 
> My question is, how to achieve what I want? The simpler, the better :)
> 



You may want to call an external script directly from rc.local instead,
to avoid breaking stuff that parses rc.conf

Never know ;)
It's not like rc.conf is a totally critical file that will break your
startup if you mess it up...



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