diff options
author | Soren Hansen <soren@canonical.com> | 2009-08-11 17:43:11 +0200 |
---|---|---|
committer | Soren Hansen <soren@canonical.com> | 2009-08-11 17:43:11 +0200 |
commit | 5ae04f117f90cd6fac5d515373959636c36761f7 (patch) | |
tree | 9671c1008e5aab330d6bd7e34bcc2cf593a68bed | |
parent | c21874b1921a65c6864dbb7d7e73e787aef6aeba (diff) | |
download | vyos-cloud-init-5ae04f117f90cd6fac5d515373959636c36761f7.tar.gz vyos-cloud-init-5ae04f117f90cd6fac5d515373959636c36761f7.zip |
Update /etc/default/locale with locale setting derived from locality.
-rwxr-xr-x | ec2-set-defaults.py | 14 | ||||
-rw-r--r-- | templates/default-locale.tmpl | 1 |
2 files changed, 10 insertions, 5 deletions
diff --git a/ec2-set-defaults.py b/ec2-set-defaults.py index 0e0d4843..4191538e 100755 --- a/ec2-set-defaults.py +++ b/ec2-set-defaults.py @@ -36,19 +36,23 @@ def main(): generate_sources_list(mirror) +def render_to_file(template, outfile, searchList): + t = Template(file='/etc/ec2-init/templates/%s.tmpl' % template, searchList=[searchList]) + f = open(outfile, 'w') + f.write(t.respond()) + f.close() + def apply_locale(locale): subprocess.Popen(['locale-gen', locale]).communicate() subprocess.Popen(['update-locale', locale]).communicate() + render_to_file('default-locale', '/etc/default/locale', { 'locale' : locale }) + def generate_sources_list(mirror): stdout, stderr = subprocess.Popen(['lsb_release', '-cs'], stdout=subprocess.PIPE).communicate() codename = stdout.strip() - mp = { 'mirror' : mirror, 'codename' : codename } - t = Template(file='/etc/ec2-init/templates/sources.list.tmpl', searchList=[mp]) - f = open('/etc/apt/sources.list', 'w') - f.write(t.respond()) - f.close() + render_to_file('sources.list', '/etc/apt/sources.list', { 'mirror' : mirror, 'codename' : codename }) if __name__ == '__main__': main() diff --git a/templates/default-locale.tmpl b/templates/default-locale.tmpl new file mode 100644 index 00000000..7940672b --- /dev/null +++ b/templates/default-locale.tmpl @@ -0,0 +1 @@ +LANG="$locale" |