5 # Manage network related configuration files
7 # Mark Huang <mlhuang@cs.princeton.edu>
8 # Copyright (C) 2006 The Trustees of Princeton University
13 # Source function library and configuration
14 . /etc/plc.d/functions
15 . /etc/planetlab/plc_config
22 MESSAGE=$"Generating network files"
25 mv -f /etc/hosts /etc/hosts_plc.backup
29 for server in DB API BOOT WWW ; do
30 hostname=PLC_${server}_HOST
32 if [ -n "${!ip}" ] ; then
33 echo "${!ip} ${!hostname}"
35 ip=$(gethostbyname ${!hostname})
36 if [ -n "$ip" ] ; then
37 echo "$ip ${!hostname}"
42 grep -v "^#" /etc/hosts >> $hfile
43 echo "#generated by /etc/plc.d/network" >/etc/hosts
44 echo "127.0.0.1 localhost.localdomain localhost" >> $hfile
45 sort -u $hfile >> /etc/hosts
53 MESSAGE=$"Reverting network files"
54 if [ -f /etc/hosts_plc.backup ] ; then
55 mv -f /etc/hosts_plc.backup /etc/hosts