Profile rc idea

Alexander Leidinger Alexander at Leidinger.net
Fri May 29 09:17:13 UTC 2009


Quoting Nathan Lay <nslay at comcast.net> (from Thu, 28 May 2009 18:40:36 -0400):

> Hi list,
> Wasn't sure which list this idea belongs, so I sent it here.  It

arch@ (cced) is the generic place to discuss architectural changes of  
subsystems.

> would be interesting if rc was extended to support profiles.  Each  
> profile would reflect a different system configuration.  For example  
> profiles could describe the computing environment at: home, work,  
> friend's house, airplane, etc... The active profile the system uses  
> could be chosen based on some contingency condition.  For example,  
> simply prompting the user to choose an rc profile at boot, or using  
> hardware to choose the profile (e.g. like location based contingency  
> using GPS hardware), or whatever...  I guess this only pertains to  
> booting though, but rc seems like a natural place to do this.   
> Thoughts, comments?  Yet another idea I have no time to try...

You can already do this in rc.conf:
---snip---
location=at_home

case ${location} in
at_home)
    ifconfig_xx0="..."
    ...
    ;;
at_work)
    ifconfig_xx0="..."
    ...
    ;;
*)
    echo wrong location set
    exit 1
    # alternatively use some kind of default setup
    ;;
esac
---snip---

This way you need to know before where you are, or boot into  
single-user mode. You can also extend it to read a kenv  
("location=$(/bin/kenv profile.location)"), this way you can specify  
the location in the loader (bonus points to implement a loader  
extension in forth to read a file which lists possible profiles and  
offer them in the menu).

Bye,
Alexander.

-- 
	"I keep seeing spots in front of my eyes."
	"Did you ever see a doctor?"
	"No, just spots."

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137


More information about the freebsd-arch mailing list