Date: Tue, 8 Sep 1998 08:52:34 +0200 (CEST) From: Dirk-Willem van Gulik <dirk.vangulik@jrc.it> To: Marc Slemko <marcs@znep.com> Cc: Mike Smith <mike@smith.net.au>, mobile@FreeBSD.ORG Subject: Re: my pccard changes Message-ID: <Pine.BSF.3.96.980908083602.275Y-100000@elpc36.jrc.it> In-Reply-To: <Pine.BSF.4.03.9809071317360.10533-100000@alive.znep.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 7 Sep 1998, Marc Slemko wrote: > On Sun, 6 Sep 1998, Mike Smith wrote: > > > > In my situation I take my laptop between multiple ethernets, and I can't > > > use DHCP because I'm unlucky. > > ... > > > and a shell script that lets me just run "location home" and have > > > pccard_location="home" put into /etc/pccard_location. The same applies > > > for any number of locations. > > > > > > Pretty simple modificatons; just FYI if anyone else was wanting to do the > > > same thing but hadn't bothered to. > > > > What you want is this: > > Except that that doesn't deal with wanting to just modify parts of a file. > > I agree that, in general, when you need changed resolv.conf, and arbitrary > other files it may make sense. > > But you still need other changes; either modifying pccard_ether with hacks > or replacing it, replacing rc.conf, etc. And it really doesn't make sense > to completely replace either of those just for one or two settings. I > don't see anywhere that I can completely replace a file to change the IP > address and default route without also having a lot more baggage around. I could not agree more ! I ended up sourcing the '. rc.conf' each time and then overriding a few. Unfortunately not all DHCP servers supply all values. So that ends up beeing messy too. Dw. #>/etc/locs # location ip mask router dns(s) webweaving DHCP behind 10.0.1.109 255.255.255.128 10.0.1.1 10.0.1.2 front 139.191.7.99 255.255.255.0 139.191.7.1 139.191.7.3 elsvier 123.7.240.9 255.255.255.0 123.7.240.254 #!/usr/local/bin/perl # dirkx@webweaving.org - for vaio $loc=lc shift or `cat /etc/.lastloc`; open(F,'/etc/locs') or die "Could not open location file:$!"; while(<F>) { chomp; next if m/^\s*\#g/; ($tloc,$ip,$net,$router,@dns)=split; ($ok=1,last) if $loc eq lc $tloc; }; die "No such location" unless $ok; open(F,'>/etc.lastloc');print F $loc;close(F); push @dns,"139.191.1.142" unless $#dns>0; %vars=( 'ifconfig_unkown' => $ip, 'ifconfig_pccard' => $ip, 'default_router' => $router ); if ($ip ne 'DHCP') { mv '/etc/resolv.conf','/etc/resolv.conf.old' or die "CNM:$!"; open(F,'>/etc/resolv.conf'); print F "# Created $0 $loc - ".gmtime(time)."\n"; print F "search webweaving.org. jrc.it .\n"; map { print F "nameserver $_\n" } @dns; close(F); $vars{ ifconfig_pccard } .=' netmask '.$net; }; $comm = ". rc.conf\n"; foreach(keys(%vars)) { $comm .= "$_ = \"$vars{$_}\"\nexport $_\n"; }; $comm .="/etc/pccard_config all\n"; exec $comm; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980908083602.275Y-100000>