systemd knows the following config files: /etc/hostname /etc/vconsole.conf /etc/locale.conf
FESCo asked us to make sure all Fedora packages use the new config files, not the legacy sysconfig files.
For details see the tracker bug: https://bugzilla.redhat.com/show_bug.cgi?id=881785
Michal Schmidt (3): Write /etc/hostname (#871543) Stop writing /etc/sysconfig/i18n (#871543) Stop writing /etc/sysconfig/keyboard (#871543)
pyanaconda/keyboard.py | 14 ++------------ pyanaconda/localization.py | 13 +------------ pyanaconda/network.py | 14 +++++++++++++- 3 files changed, 16 insertions(+), 25 deletions(-)
Write the hostname to /etc/hostname instead of /etc/sysconfig/network. --- pyanaconda/network.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py index 1df8ab0..1b22966 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -51,6 +51,7 @@ log = logging.getLogger("anaconda") sysconfigDir = "/etc/sysconfig" netscriptsDir = "%s/network-scripts" % (sysconfigDir) networkConfFile = "%s/network" % (sysconfigDir) +hostnameFile = "/etc/hostname" ipv6ConfFile = "/etc/modprobe.d/ipv6.conf" ifcfgLogFile = "/tmp/ifcfg.log" CONNECTION_TIMEOUT = 45 @@ -798,6 +799,17 @@ def get_ifcfg_value(iface, key, root_path=""): dev.loadIfcfgFile() return dev.get(key)
+def write_hostname(rootpath, ksdata, overwrite=False): + cfgfile = os.path.normpath(rootpath + hostnameFile) + if (os.path.isfile(cfgfile) and not overwrite): + return False + + f = open(cfgfile, "w") + f.write("%s\n" % ksdata.network.hostname) + f.close() + + return True + def write_sysconfig_network(rootpath, ksdata, overwrite=False):
cfgfile = os.path.normpath(rootpath + networkConfFile) @@ -807,7 +819,6 @@ def write_sysconfig_network(rootpath, ksdata, overwrite=False): f = open(cfgfile, "w") f.write("# Generated by anaconda\n") f.write("NETWORKING=yes\n") - f.write("HOSTNAME=%s\n" % ksdata.network.hostname)
gateway = ipv6_defaultgw = None for iface in reversed(getDevices()): @@ -902,6 +913,7 @@ def usedByRootOnISCSI(iface, storage): return False
def writeNetworkConf(storage, ksdata, instClass): + write_hostname(ROOT_PATH, ksdata, overwrite=flags.livecdInstall) write_sysconfig_network(ROOT_PATH, ksdata, overwrite=flags.livecdInstall) disableIPV6(ROOT_PATH) if not flags.imageInstall:
Looks good to me.
On 12/04/2012 02:29 PM, Michal Schmidt wrote:
Write the hostname to /etc/hostname instead of /etc/sysconfig/network.
pyanaconda/network.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py index 1df8ab0..1b22966 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -51,6 +51,7 @@ log = logging.getLogger("anaconda") sysconfigDir = "/etc/sysconfig" netscriptsDir = "%s/network-scripts" % (sysconfigDir) networkConfFile = "%s/network" % (sysconfigDir) +hostnameFile = "/etc/hostname" ipv6ConfFile = "/etc/modprobe.d/ipv6.conf" ifcfgLogFile = "/tmp/ifcfg.log" CONNECTION_TIMEOUT = 45 @@ -798,6 +799,17 @@ def get_ifcfg_value(iface, key, root_path=""): dev.loadIfcfgFile() return dev.get(key)
+def write_hostname(rootpath, ksdata, overwrite=False):
cfgfile = os.path.normpath(rootpath + hostnameFile)
if (os.path.isfile(cfgfile) and not overwrite):
return Falsef = open(cfgfile, "w")
f.write("%s\n" % ksdata.network.hostname)
f.close()
return True
def write_sysconfig_network(rootpath, ksdata, overwrite=False):
cfgfile = os.path.normpath(rootpath + networkConfFile)@@ -807,7 +819,6 @@ def write_sysconfig_network(rootpath, ksdata, overwrite=False): f = open(cfgfile, "w") f.write("# Generated by anaconda\n") f.write("NETWORKING=yes\n")
f.write("HOSTNAME=%s\n" % ksdata.network.hostname)
gateway = ipv6_defaultgw = None for iface in reversed(getDevices()):
@@ -902,6 +913,7 @@ def usedByRootOnISCSI(iface, storage): return False
def writeNetworkConf(storage, ksdata, instClass):
- write_hostname(ROOT_PATH, ksdata, overwrite=flags.livecdInstall) write_sysconfig_network(ROOT_PATH, ksdata, overwrite=flags.livecdInstall) disableIPV6(ROOT_PATH) if not flags.imageInstall:
On Tue, Dec 04, 2012 at 11:27:12AM -0500, Chris Lumens wrote:
Looks good to me.
You'll also need to git am these patches since he doesn't have commit access.
I'll handle that.
Write only /etc/locale.conf. --- pyanaconda/localization.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/pyanaconda/localization.py b/pyanaconda/localization.py index 066a7ad..e806adf 100644 --- a/pyanaconda/localization.py +++ b/pyanaconda/localization.py @@ -30,7 +30,6 @@ import babel
LOCALE_PREFERENCES = {}
-SYSCONF_I18N_FILE_PATH = "/etc/sysconfig/i18n" LOCALE_CONF_FILE_PATH = "/etc/locale.conf"
class LocalizationConfigError(Exception): @@ -270,8 +269,7 @@ def _get_locale_script(locale):
def write_language_configuration(lang, root): """ - Write language configuration to the $root/etc/sysconfig/i18n and the - $root/etc/locale.conf files. + Write language configuration to the $root/etc/locale.conf file.
@param lang: ksdata.lang object @param root: path to the root of the installed system @@ -279,15 +277,6 @@ def write_language_configuration(lang, root): """
try: - fpath = os.path.normpath(root + SYSCONF_I18N_FILE_PATH) - with open(fpath, "w") as fobj: - fobj.write('LANG="%s"\n' % lang.lang) - - except IOError as ioerr: - msg = "Cannot write language configuration file: %s" % ioerr.strerror - raise LocalizationConfigError(msg) - - try: fpath = os.path.normpath(root + LOCALE_CONF_FILE_PATH) with open(fpath, "w") as fobj: fobj.write('LANG="%s"\n' % lang.lang)
Write only /etc/vconsole.conf. --- pyanaconda/keyboard.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py index 5d4db68..828c709 100755 --- a/pyanaconda/keyboard.py +++ b/pyanaconda/keyboard.py @@ -133,8 +133,8 @@ def get_layouts_xorg_conf(keyboard): def write_keyboard_config(keyboard, root, convert=True, weight=0): """ Function that writes files with layouts configuration to - $root/etc/X11/xorg.conf.d/01-anaconda-layouts.conf, - $root/etc/sysconfig/keyboard and $root/etc/vconsole.conf. + $root/etc/X11/xorg.conf.d/01-anaconda-layouts.conf and + $root/etc/vconsole.conf.
@param keyboard: ksdata.keyboard object @param root: path to the root of the installed system @@ -162,9 +162,6 @@ def write_keyboard_config(keyboard, root, convert=True, weight=0): xconf_dir = os.path.normpath(root + "/etc/X11/xorg.conf.d") xconf_file = "%0.2d-anaconda-keyboard.conf" % weight
- sysconf_dir = os.path.normpath(root + "/etc/sysconfig") - sysconf_file = "keyboard" - vcconf_dir = os.path.normpath(root + "/etc") vcconf_file = "vconsole.conf"
@@ -186,13 +183,6 @@ def write_keyboard_config(keyboard, root, convert=True, weight=0):
if keyboard.vc_keymap: try: - with open(os.path.join(sysconf_dir, sysconf_file), "w") as fobj: - fobj.write('KEYMAP="%s"\n' % keyboard.vc_keymap) - - except IOError as ioerr: - errors.append("Cannot write sysconfig keyboard configuration file") - - try: with open(os.path.join(vcconf_dir, vcconf_file), "w") as fobj: fobj.write('KEYMAP="%s"\n' % keyboard.vc_keymap) except IOError as ioerr:
anaconda-patches@lists.fedorahosted.org