diff --git a/aif.xsd b/aif.xsd index 5320c07..57bc91e 100644 --- a/aif.xsd +++ b/aif.xsd @@ -1058,9 +1058,7 @@ - - - + @@ -1165,6 +1163,8 @@ + + diff --git a/aif/system/__init__.py b/aif/system/__init__.py index e91eeb7..0a0bb0a 100644 --- a/aif/system/__init__.py +++ b/aif/system/__init__.py @@ -2,3 +2,7 @@ from . import locales from . import console from . import users from . import services + + +def main(system_xml): + pass diff --git a/aif/system/locales.py b/aif/system/locales.py index 2d85d39..9cc424e 100644 --- a/aif/system/locales.py +++ b/aif/system/locales.py @@ -105,3 +105,23 @@ class Locale(object): os.chmod(cfg, 0o0644) os.chown(cfg, 0, 0) return() + + +class Timezone(object): + def __init__(self, timezone): + self.tz = timezone.strip().replace('.', '/') + + def _verify(self, chroot_base): + tzfilebase = os.path.join('usr', 'share', 'zoneinfo', self.tz) + tzfile = os.path.join(chroot_base, tzfilebase) + if not os.path.isfile(tzfile): + raise ValueError('Invalid timezone') + return(tzfilebase) + + def apply(self, chroot_base): + tzsrcfile = os.path.join('/', self._verify(chroot_base)) + tzdestfile = os.path.join(chroot_base, 'etc', 'localtime') + if os.path.isfile(tzdestfile): + os.remove(tzdestfile) + os.symlink(tzsrcfile, tzdestfile) + return() diff --git a/aif/system/main.py b/aif/system/main.py deleted file mode 100644 index 4640904..0000000 --- a/aif/system/main.py +++ /dev/null @@ -1 +0,0 @@ -# TODO diff --git a/examples/aif.xml b/examples/aif.xml index 86d74c6..85e7844 100644 --- a/examples/aif.xml +++ b/examples/aif.xml @@ -2,7 +2,9 @@ + version="v2_rewrite" + chrootPath="/mnt/aif" + reboot="false"> @@ -162,7 +164,7 @@ - + 1ns3cur3p4ssw0rd