mirror of
https://github.com/gryf/wicd.git
synced 2025-12-19 20:38:00 +01:00
add support for copying dhclient.conf.template from a default file if it isn't found
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
# wicd will replace $_HOSTNAME in the following line with
|
||||
# the appropriate hostname for this system
|
||||
send host-name "$_HOSTNAME";
|
||||
22
other/dhclient.conf.template.default
Normal file
22
other/dhclient.conf.template.default
Normal file
@@ -0,0 +1,22 @@
|
||||
# If you're reading this, you're probably reading either:
|
||||
# /etc/wicd/dhclient.conf.template.default
|
||||
# or
|
||||
# /etc/wicd/dhclient.conf.template
|
||||
# or
|
||||
# a generated dhclient configuration in /var/run
|
||||
# (these files could be in different locations, as determined by your
|
||||
# packager or system administrator, but those are the default pathes)
|
||||
#
|
||||
# Here's what you need to know:
|
||||
# The .default file is copied by wicd to dhclient.conf.template if
|
||||
# dhclient.conf.template does not exist. If dhclient.conf.template
|
||||
# does exist, the .default file is not used. This is to allow
|
||||
# upgrades of the package without destroying user changes.
|
||||
#
|
||||
# In other words, if you want to change the generated dhclient
|
||||
# configuration, you need to change dhclient.conf.template,
|
||||
# NOT dhclient.conf.template.default
|
||||
|
||||
# wicd will replace $_HOSTNAME in the following line with
|
||||
# the appropriate hostname for this system
|
||||
send host-name "$_HOSTNAME";
|
||||
2
setup.py
2
setup.py
@@ -473,7 +473,7 @@ try:
|
||||
data = [
|
||||
(wpath.dbus, ['other/wicd.conf']),
|
||||
(wpath.log, []),
|
||||
(wpath.etc, ['other/dhclient.conf.template']),
|
||||
(wpath.etc, ['other/dhclient.conf.template.default']),
|
||||
(wpath.encryption, [('encryption/templates/' + b) for b in
|
||||
os.listdir('encryption/templates') if not b.startswith('.')]),
|
||||
(wpath.networks, []),
|
||||
|
||||
@@ -34,6 +34,7 @@ class WirelessDaemon() -- DBus interface to managed the wireless network.
|
||||
#
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import time
|
||||
import getopt
|
||||
@@ -66,6 +67,7 @@ misc.RenameProcess("wicd")
|
||||
|
||||
wireless_conf = wpath.etc + "wireless-settings.conf"
|
||||
wired_conf = wpath.etc + "wired-settings.conf"
|
||||
dhclient_conf = wpath.etc + "dhclient.conf.template"
|
||||
|
||||
class WicdDaemon(dbus.service.Object):
|
||||
""" The main wicd daemon class.
|
||||
@@ -936,6 +938,9 @@ class WicdDaemon(dbus.service.Object):
|
||||
open(wired_conf, "w").close()
|
||||
b_wired.CreateWiredNetworkProfile("wired-default", default=True)
|
||||
|
||||
if not os.path.isfile(dhclient_conf):
|
||||
print "dhclient.conf.template not found, copying..."
|
||||
shutil.copy(dhclient_conf + ".default", dhclient_conf)
|
||||
# Hide the files, so the keys aren't exposed.
|
||||
print "chmoding configuration files 0600..."
|
||||
os.chmod(app_conf.get_config(), 0600)
|
||||
|
||||
Reference in New Issue
Block a user