Various tweaks for myplc-native (not thoroughly tested yet) :
[myplc.git] / plc.d / network
index d5f615f..39d44e9 100755 (executable)
@@ -25,23 +25,20 @@ case "$1" in
        mv -f /etc/hosts /etc/hosts_plc.backup
        hfile=$(mktemp)
        # Minimal /etc/hosts
-       (
-           for server in DB API BOOT WWW ; do
-               hostname=PLC_${server}_HOST
-               ip=PLC_${server}_IP
-               if [ -n "${!ip}" ] ; then
-                   echo "${!ip}        ${!hostname}"
-               else
-                   ip=$(gethostbyname ${!hostname})
-                   if [ -n "$ip" ] ; then
-                       echo "$ip       ${!hostname}"
-                   fi
+       for server in DB API BOOT WWW ; do
+           hostname=PLC_${server}_HOST
+           ip=PLC_${server}_IP
+           if [ -n "${!ip}" ] ; then
+               echo "${!ip}    ${!hostname}"
+           else
+               ip=$(gethostbyname ${!hostname})
+               if [ -n "$ip" ] ; then
+                   echo "$ip   ${!hostname}"
                fi
-           done
-       ) > $hfile
-       grep -v "^#" /etc/hosts >> $hfile
+           fi
+       done > $hfile
        echo "#generated by /etc/plc.d/network" >/etc/hosts
-       echo "127.0.0.1 localhost.localdomain localhost" >> $hfile
+       echo "127.0.0.1 localhost.localdomain localhost" >> /etc/hosts
        sort -u $hfile >> /etc/hosts
        chmod +r /etc/hosts
        rm -f $hfile