#! /bin/csh -f # echo "$0 : Version 5-aug-2002 PJT" # reconfigure your network (eth, ppp, ....) setup for a roaming machine # # oct-1999 PJT created # jul-2000 PJT more documentation,move to /usr/sbin report state.... # oct-2000 PJT documented this a bit more # sep-2001 PJT rh71 with printconf's /etc/alchemist/namespace/printconf # feb-2002 PJT update pcmcia when config changed # apr-2002 PJT restart lpd is printer profile changed # aug-2002 PJT restart pcmcia at the end, also some wireless additions # # Usage: # in your system directories (see $sysdir below) make # backups of your configuration files that you need for a specific # site, e.g. # in /etc: cp resolv.conf resolv.conf_home # # The most common files you want to keep under control of eth_configure # are: # /etc/resolv.conf DNS # /etc/printcap printer setup # /etc/sysconfig/network gateway, your hostname # /etc/sysconfig/static-routes static routes, rarely needed # /etc/sysconfig/network-scripts/ifcfg-eth0 IP setup for ethernet # /etc/sysconfig/network-scripts/ifcfg-ppp0 IP setup for modem # /etc/pcmcia/wireless.opts Wireless # # The /etc/pcmcia has been added, e.g. for my wireless i need to have # multiple copies of wlan.opts # you can add directories to this list. Note, this list is useful for REDHAT # other distribution may have to look in other directories # ToDo: # if multiple args given, wait until end to redo loading # set p1=/etc/alchemist/namespace/printconf set pcmcia_upd=0 set sysdir=(/etc /etc/X11 /etc/sysconfig /etc/sysconfig/network-scripts /etc/pcmcia $p1) if ($#argv == 0) goto report if (X"$1" == "X-s") goto show set lpd_upd=0 foreach loc ($*) foreach dir ($sysdir) #echo Adding $loc #echo Visiting $dir set names=(`find $dir -maxdepth 1 -name \*_$loc -print`) if ($#names > 0) then foreach name ($names) set base=`echo $name | sed s/_$loc//` #echo $base : #echo " $name" if (-e $base) then echo cp -p $name $base cp -p $name $base if ($dir == $p1) set lpd_upd=1 if ($dir == /etc/pcmcia) set pcmcia_upd=1 endif end else #echo Nothing for _$loc in $dir endif end end if ($pcmcia_upd) then /etc/rc.d/init.d/pcmcia restart endif if ($lpd_upd) then echo FOOMATIC detection: rebuilding /etc/printcap /usr/sbin/printconf-backend --force-rebuild /etc/rc.d/init.d/lpd restart endif # this is a somewhat redhat centric method of guessing your current setup report: grep ^GATEWAY= /etc/sysconfig/network-scripts/ifcfg-eth0 grep ^IPADDR= /etc/sysconfig/network-scripts/ifcfg-eth0 grep ^nameserver /etc/resolv.conf echo printconf directory: /etc/alchemist/namespace/printconf exit show: foreach dir ($sysdir) set names=(`find $dir -maxdepth 1 -name \*_\* -print`) foreach n ($names) echo $n end end