git://git.onelab.eu
/
myplc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
killproc no longer available in image
[myplc.git]
/
plc.d
/
dns
diff --git
a/plc.d/dns
b/plc.d/dns
index
b195809
..
b72b5a3
100755
(executable)
--- a/
plc.d/dns
+++ b/
plc.d/dns
@@
-1,6
+1,6
@@
#!/bin/bash
#
#!/bin/bash
#
-# priority:
8
50
+# priority:
9
50
#
# Start local DNS server to provide minimal DNS forward resolution for
# ourselves and our nodes.
#
# Start local DNS server to provide minimal DNS forward resolution for
# ourselves and our nodes.
@@
-8,14
+8,12
@@
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
-# $Id$
-#
# Source function library and configuration
. /etc/plc.d/functions
. /etc/planetlab/plc_config
# Source function library and configuration
. /etc/plc.d/functions
. /etc/planetlab/plc_config
-SIGNATURE="; generated by /etc/plc.d/dns --- DO NOT REMOVE THIS TEXT
!
"
+SIGNATURE="; generated by /etc/plc.d/dns --- DO NOT REMOVE THIS TEXT"
# Be verbose
set -x
# Be verbose
set -x
@@
-23,7
+21,7
@@
set -x
case "$1" in
start)
if [ $PLC_DNS_ENABLED -eq 1 ] ; then
case "$1" in
start)
if [ $PLC_DNS_ENABLED -eq 1 ] ; then
- MESSAGE=
$
"Starting DNS server"
+ MESSAGE="Starting DNS server"
dialog "$MESSAGE"
dns-config
dialog "$MESSAGE"
dns-config
@@
-32,7
+30,7
@@
case "$1" in
# Set up nameservers
if [ -n "$PLC_NET_DNS1" -o -n "$PLC_NET_DNS2" ] ; then
# Set up nameservers
if [ -n "$PLC_NET_DNS1" -o -n "$PLC_NET_DNS2" ] ; then
- MESSAGE=
$
"Configuring resolv.conf"
+ MESSAGE="Configuring resolv.conf"
dialog "$MESSAGE"
rfile=$(mktemp)
dialog "$MESSAGE"
rfile=$(mktemp)
@@
-41,7
+39,7
@@
case "$1" in
[ -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
[ -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 [ $PLC_DNS_ENABLED -eq 1 ] ; then
ourfile=$(grep "$SIGNATURE" /etc/resolv.conf| wc -l)
if [ $ourfile -eq 0 ] ; then
if [ $PLC_DNS_ENABLED -eq 1 ] ; then
ourfile=$(grep "$SIGNATURE" /etc/resolv.conf| wc -l)
if [ $ourfile -eq 0 ] ; then
@@
-63,31
+61,38
@@
case "$1" in
;;
stop)
;;
stop)
- MESSAGE=$"Reverting /etc/resolv.conf and /etc/hosts"
- dialog "$MESSAGE"
if [ $PLC_DNS_ENABLED -eq 1 ] ; then
if [ $PLC_DNS_ENABLED -eq 1 ] ; then
+ MESSAGE=$"Reverting /etc/resolv.conf"
+ dialog "$MESSAGE"
if [ -f "/etc/plc_resolv.conf" ] ; then
ourfile=$(grep "$SIGNATURE" /etc/plc_resolv.conf| wc -l)
if [ -f "/etc/plc_resolv.conf" ] ; then
ourfile=$(grep "$SIGNATURE" /etc/plc_resolv.conf| wc -l)
- if [ $ourfile -ne 0 ] ; then
- dialog "WARNING: original /etc/resolv.conf was generated by etc/plc.d/dns"
+ if [ $ourfile -ne 0 ] ; then
+ dialog "WARNING: original /etc/resolv.conf was generated by etc/plc.d/dns"
fi
mv -f /etc/plc_resolv.conf /etc/resolv.conf
fi
fi
mv -f /etc/plc_resolv.conf /etc/resolv.conf
fi
+ check
+ result ""
+ MESSAGE=$"Removing /etc/plc_hosts"
+ dialog "$MESSAGE"
[ -f "/etc/plc_hosts" ] && rm -f /etc/plc_hosts
[ -f "/etc/plc_hosts" ] && rm -f /etc/plc_hosts
+ result ""
fi
if [ $PLC_DNS_ENABLED -eq 0 -a -f "/etc/resolv_plc.backup" ] ; then
fi
if [ $PLC_DNS_ENABLED -eq 0 -a -f "/etc/resolv_plc.backup" ] ; then
+ MESSAGE="Restoring /etc/resolv.conf"
+ dialog "$MESSAGE"
mv -f /etc/resolv_plc.backup /etc/resolv.conf
mv -f /etc/resolv_plc.backup /etc/resolv.conf
+ result ""
fi
if [ $PLC_DNS_ENABLED -eq 1 ] ; then
fi
if [ $PLC_DNS_ENABLED -eq 1 ] ; then
- MESSAGE=
$
"Stopping DNS server"
+ MESSAGE="Stopping DNS server"
dialog "$MESSAGE"
dialog "$MESSAGE"
-
- killproc plc_dnsmasq
+ pkill -f plc_dnsmasq
check
check
+ result ""
fi
fi
- result "$MESSAGE"
;;
esac
;;
esac