Re: Newbie custom config questions

Riccardo Torrini <[email protected]>
Newsgroups gmane.os.freebsd.freesbie
Message-ID <[email protected]>
On Thu, Dec 29, 2005 at 12:16:09PM -0500, Lee J. Imber wrote:

> 3. ifconfig_fxp0 ... Unfortunately I do not remember what the
> interface is on my box on the west coast. I *think* its fxp0 ...

Try this bad hack (don't blame me if it doesn't work, double check).


-----8<-----[ /etc/rc.conf ]-----8<-----
# wrapped for readability
ifconfig_`ifconfig -l | \
	sed -Ee 's/(lo|slip|plip)[0-9] *//g'`="inet 1.2.3.4 ..."
-----8<-----

Note: if you have more than one interface it fail, if you have IPv6
it may fail (never tryed), if it is raining can fail and so on  :-)


Anyway, you can also try with a loop, rc.conf is sourced from sh:

-----8<-----[ /etc/rc.conf ]-----8<-----
# alternative version
for myHack in `ifconfig -l | sed -Ee 's/(lo|slip|plip)[0-9] *//g'`
do
	ifconfig_$myHack="inet 1.2.3.4 ..."
done
-----8<-----


Just tryed myself.  No way.  Two solutions:
- add a lot of potentially valid interfaces (fxp, bge, vr, rl, ...)
- create a temporary file and source it

-----8<-----[ /etc/rc.conf ]-----8<-----
# hope-it-works version
tmp=/tmp/source_me.$$
for myHack in `ifconfig -l | sed -Ee 's/(lo|slip|plip)[0-9] *//g'`
do
	echo "ifconfig_$myHack=\"inet 1.2.3.4 ...\"" >> ${tmp}
done
source ${tmp}
## rm ${tmp}
-----8<-----


-- 
Riccardo. ( http://www.GUFI.org/~vic/ )
-- 
FreeSBIE mailing list (http://www.freesbie.org)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.