mirror of
https://github.com/gryf/wicd.git
synced 2026-01-09 07:14:13 +01:00
restore old resolv.conf file on -k instead of sigterm
This commit is contained in:
@@ -1744,6 +1744,14 @@ def main(argv):
|
|||||||
except:
|
except:
|
||||||
#print >> sys.stderr, "No wicd instance active, aborting."
|
#print >> sys.stderr, "No wicd instance active, aborting."
|
||||||
sys.exit(1)
|
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
|
from wicd import dbusmanager
|
||||||
bus = dbusmanager.connect_to_dbus()
|
bus = dbusmanager.connect_to_dbus()
|
||||||
dbus_ifaces = dbusmanager.get_dbus_ifaces()
|
dbus_ifaces = dbusmanager.get_dbus_ifaces()
|
||||||
@@ -1752,6 +1760,8 @@ def main(argv):
|
|||||||
f.close()
|
f.close()
|
||||||
os.kill(pid,signal.SIGTERM)
|
os.kill(pid,signal.SIGTERM)
|
||||||
|
|
||||||
|
# quit, this should be the only option specified
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
if do_daemonize: daemonize()
|
if do_daemonize: daemonize()
|
||||||
|
|
||||||
@@ -1804,12 +1814,6 @@ def main(argv):
|
|||||||
|
|
||||||
def on_exit(child_pid):
|
def on_exit(child_pid):
|
||||||
""" Called when a SIGTERM is caught, kills monitor.py before exiting. """
|
""" 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:
|
if child_pid:
|
||||||
print 'Daemon going down, killing wicd-monitor...'
|
print 'Daemon going down, killing wicd-monitor...'
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user