From: Marc Fiuczynski Date: Fri, 1 Feb 2008 21:04:36 +0000 (+0000) Subject: - moved all dns related functionality to the plc.d/dns file X-Git-Tag: myplc-4.2-3~8 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=f41d649afe4be211d173a3116705d5f6fa8073f5;p=myplc.git - moved all dns related functionality to the plc.d/dns file - now backing up the contents of the orig /etc/hosts on myplc startup and reverting to that when stopping myplc. --- diff --git a/plc.d/network b/plc.d/network index 5d3d443..d5f615f 100755 --- a/plc.d/network +++ b/plc.d/network @@ -22,6 +22,7 @@ case "$1" in MESSAGE=$"Generating network files" dialog "$MESSAGE" + mv -f /etc/hosts /etc/hosts_plc.backup hfile=$(mktemp) # Minimal /etc/hosts ( @@ -45,20 +46,14 @@ case "$1" in chmod +r /etc/hosts rm -f $hfile - # Set up nameservers - rfile=$(mktemp) - ( - echo "; generated by /etc/plc.d/network" - [ -n "$PLC_NET_DNS1" ] && echo "nameserver $PLC_NET_DNS1" - [ -n "$PLC_NET_DNS2" -a "$PLC_NET_DNS1" != "$PLC_NET_DNS2" ] && echo "nameserver $PLC_NET_DNS2" - ) > $rfile - if [ -n "$PLC_NET_DNS1" -o -n "$PLC_NET_DNS2" ] ; then - mv $rfile /etc/resolv.conf - chmod 444 /etc/resolv.conf - else - rm -f $rfile - fi + result "$MESSAGE" + ;; + stop) + MESSAGE=$"Reverting network files" + if [ -f /etc/hosts_plc.backup ] ; then + mv -f /etc/hosts_plc.backup /etc/hosts + fi result "$MESSAGE" ;; esac