5 # Manage network related configuration files
7 # Mark Huang <mlhuang@cs.princeton.edu>
8 # Copyright (C) 2006 The Trustees of Princeton University
11 # Source function library and configuration
12 . /etc/plc.d/functions
13 . /etc/planetlab/plc_config
18 [ "$PLC_HOSTS_ENABLED" -ne 1 ] && exit 0
22 MESSAGE=$"Generating network files"
25 mv -f /etc/hosts /etc/hosts_plc.backup
28 for server in DB API BOOT WWW ; do
29 hostname=PLC_${server}_HOST
31 if [ -n "${!ip}" ] ; then
32 echo "${!ip} ${!hostname}"
34 ip=$(gethostbyname ${!hostname})
35 if [ -n "$ip" ] ; then
36 echo "$ip ${!hostname}"
40 echo "#generated by /etc/plc.d/network" >/etc/hosts
41 echo "127.0.0.1 localhost.localdomain localhost" >> /etc/hosts
42 sort -u $hfile >> /etc/hosts
50 MESSAGE=$"Reverting network files"
51 if [ -f /etc/hosts_plc.backup ] ; then
52 mv -f /etc/hosts_plc.backup /etc/hosts