X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plc.d%2Fnetwork;h=6fac27b56b2b46eea88d6792c88d089c99568b4d;hb=dd1b3ead87960bb3e9f0b5582711a0b0c2abd601;hp=d93f4e89a964195b5240fa98c344d3f0a38af8e0;hpb=7ce915c70c5daba775ce8c723f48830e1e0e22bb;p=myplc.git diff --git a/plc.d/network b/plc.d/network index d93f4e8..6fac27b 100755 --- a/plc.d/network +++ b/plc.d/network @@ -7,7 +7,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: network,v 1.5 2006/06/23 20:29:22 mlhuang Exp $ +# $Id$ # # Source function library and configuration @@ -22,8 +22,8 @@ case "$1" in MESSAGE=$"Generating network files" dialog "$MESSAGE" + hfile=$(mktemp) # Minimal /etc/hosts - echo "127.0.0.1 localhost.localdomain localhost" >/etc/hosts ( for server in DB API BOOT WWW ; do hostname=PLC_${server}_HOST @@ -37,13 +37,21 @@ case "$1" in fi fi done - ) >>/etc/hosts + ) > $hfile + grep -v "^#" /etc/hosts >> $hfile + echo "#generated by /etc/plc.d/network" >/etc/hosts + echo "127.0.0.1 localhost.localdomain localhost" >> $hfile + sort -u $hfile >> /etc/hosts + chmod +r /etc/hosts + rm -f $hfile # Set up nameservers ( + echo "; generated by /etc/plc.d/network" [ -n "$PLC_NET_DNS1" ] && echo "nameserver $PLC_NET_DNS1" - [ -n "$PLC_NET_DNS2" ] && echo "nameserver $PLC_NET_DNS2" - ) >/etc/resolv.conf + [ -n "$PLC_NET_DNS2" -a "$PLC_NET_DNS1" != "$PLC_NET_DNS2" ] && echo "nameserver $PLC_NET_DNS2" + ) > /etc/resolv.conf + chmod +r /etc/resolv.conf result "$MESSAGE" ;;