1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-03 12:24:14 +01:00

restore old resolv.conf file on -k instead of sigterm

This commit is contained in:
Adam Blackburn
2010-01-02 21:27:41 -10:00
parent 640b6e5c16
commit 58068f0a45

View File

@@ -1744,6 +1744,14 @@ def main(argv):
except:
#print >> sys.stderr, "No wicd instance active, aborting."
sys.exit(1)
# restore resolv.conf on quit
try:
shutil.move(wpath.varlib + 'resolv.conf.orig', '/etc/resolv.conf')
except IOError:
print 'error restoring resolv.conf'
# connect to dbus, trigger a disconnect, then knock out the daemon
from wicd import dbusmanager
bus = dbusmanager.connect_to_dbus()
dbus_ifaces = dbusmanager.get_dbus_ifaces()
@@ -1752,6 +1760,8 @@ def main(argv):
f.close()
os.kill(pid,signal.SIGTERM)
# quit, this should be the only option specified
sys.exit(0)
if do_daemonize: daemonize()
@@ -1804,12 +1814,6 @@ def main(argv):
def on_exit(child_pid):
""" Called when a SIGTERM is caught, kills monitor.py before exiting. """
# restore resolv.conf on quit
try:
shutil.move(wpath.varlib + 'resolv.conf.orig', '/etc/resolv.conf')
except IOError:
print 'error restoring resolv.conf'
if child_pid:
print 'Daemon going down, killing wicd-monitor...'
try: