do not put comments in /etc/timezone
comments in /etc/timezone are not expected, and can cause problems if another tool tries to read it.
This commit is contained in:
		@@ -14,6 +14,7 @@
 | 
			
		||||
 - change trunk debian packaging to use pybuild and drop cdbs.
 | 
			
		||||
   [Dimitri John Ledkov]
 | 
			
		||||
 - SeLinuxGuard: remove invalid check that looked for stat.st_mode in os.lstat.
 | 
			
		||||
 - do not write comments in /etc/timezone (LP: #1341710)
 | 
			
		||||
0.7.5:
 | 
			
		||||
 - open 0.7.5
 | 
			
		||||
 - Add a debug log message around import failures
 | 
			
		||||
 
 | 
			
		||||
@@ -856,3 +856,12 @@ def fetch(name):
 | 
			
		||||
    mod = importer.import_module(locs[0])
 | 
			
		||||
    cls = getattr(mod, 'Distro')
 | 
			
		||||
    return cls
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def set_etc_timezone(tz, tz_file=None, tz_conf="/etc/timezone",
 | 
			
		||||
                     tz_local="/etc/localtime"):
 | 
			
		||||
    util.write_file(tz_conf, str(tz).rstrip() + "\n")
 | 
			
		||||
    # This ensures that the correct tz will be used for the system
 | 
			
		||||
    if tz_local and tz_file:
 | 
			
		||||
        util.copy(tz_file, self.tz_local_fn)
 | 
			
		||||
    return
 | 
			
		||||
 
 | 
			
		||||
@@ -32,8 +32,6 @@ LOG = logging.getLogger(__name__)
 | 
			
		||||
class Distro(distros.Distro):
 | 
			
		||||
    locale_conf_fn = "/etc/locale.gen"
 | 
			
		||||
    network_conf_dir = "/etc/netctl"
 | 
			
		||||
    tz_conf_fn = "/etc/timezone"
 | 
			
		||||
    tz_local_fn = "/etc/localtime"
 | 
			
		||||
    resolve_conf_fn = "/etc/resolv.conf"
 | 
			
		||||
    init_cmd = ['systemctl']  # init scripts
 | 
			
		||||
 | 
			
		||||
@@ -161,16 +159,7 @@ class Distro(distros.Distro):
 | 
			
		||||
        return hostname
 | 
			
		||||
 | 
			
		||||
    def set_timezone(self, tz):
 | 
			
		||||
        tz_file = self._find_tz_file(tz)
 | 
			
		||||
        # Note: "" provides trailing newline during join
 | 
			
		||||
        tz_lines = [
 | 
			
		||||
            util.make_header(),
 | 
			
		||||
            str(tz),
 | 
			
		||||
            "",
 | 
			
		||||
        ]
 | 
			
		||||
        util.write_file(self.tz_conf_fn, "\n".join(tz_lines))
 | 
			
		||||
        # This ensures that the correct tz will be used for the system
 | 
			
		||||
        util.copy(tz_file, self.tz_local_fn)
 | 
			
		||||
        set_etc_timezone(tz=tz, tz_file=self._find_tz_file(tz))
 | 
			
		||||
 | 
			
		||||
    def package_command(self, command, args=None, pkgs=None):
 | 
			
		||||
        if pkgs is None:
 | 
			
		||||
 
 | 
			
		||||
@@ -46,8 +46,6 @@ class Distro(distros.Distro):
 | 
			
		||||
    hostname_conf_fn = "/etc/hostname"
 | 
			
		||||
    locale_conf_fn = "/etc/default/locale"
 | 
			
		||||
    network_conf_fn = "/etc/network/interfaces"
 | 
			
		||||
    tz_conf_fn = "/etc/timezone"
 | 
			
		||||
    tz_local_fn = "/etc/localtime"
 | 
			
		||||
 | 
			
		||||
    def __init__(self, name, cfg, paths):
 | 
			
		||||
        distros.Distro.__init__(self, name, cfg, paths)
 | 
			
		||||
@@ -133,16 +131,7 @@ class Distro(distros.Distro):
 | 
			
		||||
        return "127.0.1.1"
 | 
			
		||||
 | 
			
		||||
    def set_timezone(self, tz):
 | 
			
		||||
        tz_file = self._find_tz_file(tz)
 | 
			
		||||
        # Note: "" provides trailing newline during join
 | 
			
		||||
        tz_lines = [
 | 
			
		||||
            util.make_header(),
 | 
			
		||||
            str(tz),
 | 
			
		||||
            "",
 | 
			
		||||
        ]
 | 
			
		||||
        util.write_file(self.tz_conf_fn, "\n".join(tz_lines))
 | 
			
		||||
        # This ensures that the correct tz will be used for the system
 | 
			
		||||
        util.copy(tz_file, self.tz_local_fn)
 | 
			
		||||
        set_etc_timezone(tz=tz, tz_file=self._find_tz_file(tz))
 | 
			
		||||
 | 
			
		||||
    def package_command(self, command, args=None, pkgs=None):
 | 
			
		||||
        if pkgs is None:
 | 
			
		||||
 
 | 
			
		||||
@@ -31,8 +31,6 @@ LOG = logging.getLogger(__name__)
 | 
			
		||||
class Distro(distros.Distro):
 | 
			
		||||
    locale_conf_fn = "/etc/locale.gen"
 | 
			
		||||
    network_conf_fn = "/etc/conf.d/net"
 | 
			
		||||
    tz_conf_fn = "/etc/timezone"
 | 
			
		||||
    tz_local_fn = "/etc/localtime"
 | 
			
		||||
    init_cmd = ['']  # init scripts
 | 
			
		||||
 | 
			
		||||
    def __init__(self, name, cfg, paths):
 | 
			
		||||
@@ -140,16 +138,7 @@ class Distro(distros.Distro):
 | 
			
		||||
        return hostname
 | 
			
		||||
 | 
			
		||||
    def set_timezone(self, tz):
 | 
			
		||||
        tz_file = self._find_tz_file(tz)
 | 
			
		||||
        # Note: "" provides trailing newline during join
 | 
			
		||||
        tz_lines = [
 | 
			
		||||
            util.make_header(),
 | 
			
		||||
            str(tz),
 | 
			
		||||
            "",
 | 
			
		||||
        ]
 | 
			
		||||
        util.write_file(self.tz_conf_fn, "\n".join(tz_lines))
 | 
			
		||||
        # This ensures that the correct tz will be used for the system
 | 
			
		||||
        util.copy(tz_file, self.tz_local_fn)
 | 
			
		||||
        set_etc_timezone(tz=tz, tz_file=self._find_tz_file(tz))
 | 
			
		||||
 | 
			
		||||
    def package_command(self, command, args=None, pkgs=None):
 | 
			
		||||
        if pkgs is None:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user