Index: /tools/config-node.sh
===================================================================
--- /tools/config-node.sh	(revision 4084)
+++ /tools/config-node.sh	(revision 4085)
@@ -1,4 +1,4 @@
 #!/bin/sh
-# (c) Copyright 2002, 2003 Stichting Wireless Leiden, all
+# (c) Copyright 2002, 2003, 2005 Stichting Wireless Leiden, all
 #     rights reserved. More information can be found on
 #     http://wwww.wirelessleiden.nl and the license is at:
@@ -9,12 +9,4 @@
 # If there is a global system configuration file, suck it in.
 #
-
-
-if [ -r /etc/defaults/rc.conf ]; then
-        . /etc/defaults/rc.conf
-        source_rc_confs
-elif [ -r /etc/rc.conf ]; then
-        . /etc/rc.conf
-fi
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
@@ -49,17 +41,17 @@
 case $proxyset in
  
-n)	
+n)  
 echo no proxy is set
-		;;
+    ;;
 y) 
-		echo this the proxy ${HTTP_PROXY}
-		export HTTP_PROXY
-		;;
+    echo this the proxy ${HTTP_PROXY}
+    export HTTP_PROXY
+    ;;
 
 *)
-		${HTTP_PROXY}=${proxyset}
-		echo this the proxy $HTTP_PROXY
-		export HTTP_PROXY
-		;;
+    ${HTTP_PROXY}=${proxyset}
+    echo this the proxy $HTTP_PROXY
+    export HTTP_PROXY
+    ;;
 esac
 
@@ -74,7 +66,4 @@
 lcd=${LCDIR:-/lcd}
 
-# True/false - logging.
-# quiet=true
-
 # Make sure we clean up our mess when needed.
 trap "rm -f ${TMPPREFIX}.?; echo Failed; exit 1;" 2 3
@@ -87,5 +76,5 @@
         killall dhclient
 fi
-	
+  
 
 echo "enter the ipadress to resolv dns" 
@@ -99,15 +88,15 @@
 case $dns_list in 
 1) 
-	resolver="172.17.8.1"
-		;;
-2) 	
-	resolver="194.109.9.99"
-		;;
+  resolver="172.17.8.1"
+    ;;
+2)   
+  resolver="194.109.9.99"
+    ;;
 3)
-	resolver="10.0.0.1"
-		;;
+  resolver="10.0.0.1"
+    ;;
 *)
-	resolver=$dns_list 
-	;;
+  resolver=$dns_list 
+  ;;
 esac
 
@@ -122,20 +111,20 @@
 do
 case ${nic} in
-	lo0) 
-		echo 	
-		;;
-	wi*)
-		echo
-		;;
-	*) 
-	if ping -qnoc ${WHOST}; then
-		echo Connection on interface ${nic} ok
-	else
-		killall dhclient
-		echo Trying to get a DHCP lease on ${nic}
-		dhclient -1 ${nic}
-	fi
-	;; 
-	esac
+  lo0) 
+    echo   
+    ;;
+  wi*)
+    echo
+    ;;
+  *) 
+  if ping -qnoc ${WHOST}; then
+    echo Connection on interface ${nic} ok
+  else
+    killall dhclient
+    echo Trying to get a DHCP lease on ${nic}
+    dhclient -1 ${nic}
+  fi
+  ;; 
+  esac
 done
 }
@@ -150,8 +139,8 @@
 fi
 if [ "x${nic_dhcp}" = "xn" ] ; then 
-	echo proceding...
-	else 
-	echo running dhclient
-	connset
+  echo proceding...
+  else 
+  echo running dhclient
+  connset
 fi
 # Logging function
@@ -159,11 +148,10 @@
 log()
 {
-	${quiet} || return
-	echo $*
+  echo $*
 }
 
 cleanse()
 {
-	rm -f ${TMPPREFIX}.?
+  rm -f ${TMPPREFIX}.?
 }
 
@@ -173,26 +161,26 @@
 cleanexit()
 {
-	E=1
-	if [ $# -gt 0 ]; then
-		E=$1
-	fi
-	cleanse
-	log Exit
-	exit $E
-	# Trap any weird exit codes.
-	exit 1
+  E=1
+  if [ $# -gt 0 ]; then
+    E=$1
+  fi
+  cleanse
+  log Exit
+  exit $E
+  # Trap any weird exit codes.
+  exit 1
 }
 
 safefetch() 
 {
-	url=$1
-	file=$2
-	fetch -q -o - ${link}${nodename} > ${TMPPREFIX}.x \
-		|| cleanexit 1
-	cp ${TMPPREFIX}.x ${dir}/${list} \
-		|| cleanexit 1
-	rm -f ${TMPPREFIX}.x
-
-	return 0
+  url=$1
+  file=$2
+  fetch -q -o - ${link}${nodename} > ${TMPPREFIX}.x \
+    || cleanexit 1
+  cp ${TMPPREFIX}.x ${dir}/${list} \
+    || cleanexit 1
+  rm -f ${TMPPREFIX}.x
+
+  return 0
 }
 
@@ -208,17 +196,17 @@
 while ! grep -q "^${nodename}\$" ${nlist}
 do
-	echo Nodes:
-	cat ${nlist}
-	echo
-	echo -n enter nodename \[default: ${default}\]:
-	if [ -z ${QUIET} ]; then	
-	  read nodename
-	else
-	  nodename=${default}
-	fi
-
-	if [ "x${nodename}" = "x" ]; then
-		nodename=${default}
-	fi
+  echo Nodes:
+  cat ${nlist}
+  echo
+  echo -n enter nodename \[default: ${default}\]:
+  if [ -z ${QUIET} ]; then  
+    read nodename
+  else
+    nodename=${default}
+  fi
+
+  if [ "x${nodename}" = "x" ]; then
+    nodename=${default}
+  fi
 done
 
@@ -226,19 +214,17 @@
 }
 
-# a function to move conf_file to admin_dir
-# and to make symlink on the old location to
-# the new location
 
 do_diff() {
-	diff -uwbB ${symdir}/${i} ${dir}/${i}.new
-}
+  diff -uwbB ${symdir}/${i} ${dir}/${i}.new
+}
+
 
 do_move() {
-if [ -x ${dir}/${i}.bak ]; then
+if [ -e ${dir}/${i}.bak ]; then
   rm ${dir}/${i}.bak
 fi
 
-if [ -x ${dir}/${i} ]; then
-  mv ${dir}/${i} ${dir}/${i}.bak  || cleanexit 1
+if [ -e ${dir}/${i} ]; then
+  mv ${dir}/${i} ${dir}/${i}.bak || cleanexit 1
   log backup ${dir}/${i} to ${dir}/${i}.bak
 fi
@@ -249,5 +235,5 @@
 
 bink() {
-	$CMD
+  $CMD
 }
 
@@ -259,24 +245,24 @@
 #
 if  [ ! -d ${dir}  ]; then 
-	mkdir -p ${dir} || cleanexit 1
+  mkdir -p ${dir} || cleanexit 1
 fi
 
 if [ -z ${HTTP_PROXY} ]; then
-	# checking connection - and only fiddle
-	# with interfaces if we need to.
-	#
-	(
-		echo no proxy defined - checking connection.
-		host ${WHOST} > /dev/null || exit 1
-		ping -qnoc 1 ${WHOST} > /dev/null || exit 1
-		exit 0
-	) || connset
+  # checking connection - and only fiddle
+  # with interfaces if we need to.
+  #
+  (
+    echo no proxy defined - checking connection.
+    host ${WHOST} > /dev/null || exit 1
+    ping -qnoc 1 ${WHOST} > /dev/null || exit 1
+    exit 0
+  ) || connset
 fi
 
 CMD=do_move
 if [ "x$1" = "x-d" ]; then
-	CMD=do_diff
-	dir=${TMPDIR}
-	shift
+  CMD=do_diff
+  dir=${TMPDIR}
+  shift
 fi
 
@@ -284,12 +270,12 @@
 #
 if [ $# = 1 ]; then
-	nodename=$1
+  nodename=$1
 else
-	if [ -r ${lcd}/myname ]; then
-		default=`cat ${lcd}/myname`
-	else
-		default=`hostname -s`
-		test -z $default && default=none
-	fi
+  if [ -r ${lcd}/myname ]; then
+    default=`cat ${lcd}/myname`
+  else
+    default=`hostname -s`
+    test -z $default && default=none
+  fi
 fi
 
@@ -306,7 +292,7 @@
 for i in `cat ${dir}/${list}`
 do
-	log getting ${i} for ${nodename} from ${link}
-	fetch -q -o - ${link}${nodename}/${i} > ${dir}/${i}.new \
-		|| cleanexit 1
+  log getting ${i} for ${nodename} from ${link}
+  fetch -q -o - ${link}${nodename}/${i} > ${dir}/${i}.new \
+    || cleanexit 1
 done
 
@@ -314,57 +300,29 @@
 for i in  `cat ${dir}/${list}`
 do
-	case ${i} in
-	linux.sh | config) 
-		log obsolete file: ${i} - skipped
-		;; 
-	resolv.conf | rc.node.local | rc.local)
-        	symdir='/etc/'
-		bink
-		;;
-	snmpd.local.conf)
-		symdir='/usr/local/share/snmp/'
-		bink
-		;;
-	named.conf)
-        	symdir='/etc/namedb/'
-		bink	
-		;;
-	dhcpd.conf)
-		symdir='/usr/local/etc/'
-	 	bink
-		;;
-	zebra.conf | ospfd.conf)
-		symdir='/usr/local/etc/zebra/'
-        	bink 
-		;;
-	authorized_keys)
-		symdir='/root/.ssh'
-		bink
-		;;	
-	daemons.sh)
-		symdir='/wl'
-		bink
-		;;
-	*)
-		echo Script cannot cope with ${i} - ignoring..
-		;;
-	esac
+  case $i in
+  txtconfig|rc.local|rc.node.local|snmpd.local.conf|resolv.conf|dhcpd.conf|named.conf)
+  bink
+    ;;
+  *)
+    echo Script cannot cope with ${i} - ignoring..
+    ;;
+  esac
 done
 
 
 if [ -e /etc/rc.local ]; then
-	# See if we are in rc.local
-	if grep -q /config-node.sh /etc/rc.local; then
-
-		echo As this node now has real configs - do enter a root password
-		echo
-		passwd \
-			|| cleanexit 1
-
-		echo Removing /etc/rc.local
-		rm -f /etc/rc.local
-	
-		echo Will drop write perms on the next reboot.
-	fi
+  # See if we are in rc.local
+  if grep -q /config-node.sh /etc/rc.local; then
+
+    echo As this node now has real configs - do enter a root password
+    echo
+    passwd \
+      || cleanexit 1
+
+    echo Removing /etc/rc.local
+    rm -f /etc/rc.local
+  
+    echo Will drop write perms on the next reboot.
+  fi
 fi
 
@@ -376,8 +334,8 @@
 hostname $H
 if [ -r  /etc/namedb/make-localhost ]; then
-	(
-		cd /etc/namedb || exit 1
-		sh /etc/namedb/make-localhost || exit 1
-	) || exit 1
+  (
+    cd /etc/namedb || exit 1
+    sh /etc/namedb/make-localhost || exit 1
+  ) || exit 1
 fi
 
@@ -385,8 +343,8 @@
 
 if [ -e /etc/rc.empty.conf ] ; then
-	rm /etc/rc.empty.conf || exit
-	echo removed /etc/rc.empty.conf - and rebooting in 30 seconds \(or press ctrl-C to abort\)
-	read -t 30 DUMMY
-	reboot
+  rm /etc/rc.empty.conf || exit
+  echo removed /etc/rc.empty.conf - and rebooting in 30 seconds \(or press ctrl-C to abort\)
+  read -t 30 DUMMY
+  reboot
 fi
 
