7 # Manage network related configuration files
9 # Mark Huang <mlhuang@cs.princeton.edu>
10 # Copyright (C) 2006 The Trustees of Princeton University
13 # Source function library and configuration
14 . /etc/plc.d/functions
15 . /etc/planetlab/plc_config
20 [ "$PLC_HOSTS_ENABLED" -ne 1 ] && exit 0
24 MESSAGE=$"Generating network files"
27 mv -f /etc/hosts /etc/hosts_plc.backup
30 for server in DB API BOOT WWW ; do
31 hostname=PLC_${server}_HOST
33 if [ -n "${!ip}" ] ; then
34 echo "${!ip} ${!hostname}"
36 ip=$(gethostbyname ${!hostname})
37 if [ -n "$ip" ] ; then
38 echo "$ip ${!hostname}"
42 echo "#generated by /etc/plc.d/network" >/etc/hosts
43 echo "127.0.0.1 localhost.localdomain localhost" >> /etc/hosts
44 sort -u $hfile >> /etc/hosts
52 MESSAGE=$"Reverting network files"
53 if [ -f /etc/hosts_plc.backup ] ; then
54 mv -f /etc/hosts_plc.backup /etc/hosts