From dd112c3afe50c75ae9b00f142b550c6e0d95f47b Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Wed, 13 May 2009 14:41:35 +0200 Subject: * Really change the locale when setting up an instance. (LP: #341066) * Run ec2-run-user-data script last. (LP: #373055) * Minor comment tweaks. (LP:373057) --- ec2-set-defaults.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'ec2-set-defaults.py') diff --git a/ec2-set-defaults.py b/ec2-set-defaults.py index 09234d0d..75a2f5c8 100755 --- a/ec2-set-defaults.py +++ b/ec2-set-defaults.py @@ -36,12 +36,23 @@ elif zone.startswith("eu"): def set_language(location,filename): if location.startswith("us"): lang='en_US.UTF-8' - os.system('locale-gen %s 2>&1 > /dev/null' %(lang)) - os.system('update-locale %s 2>&1 > /dev/null' %(lang)) elif location.startswith("eu"): lang='en_GB.UTF-8' - os.system('locale-gen %s 2>&1 > /dev/null' %(lang)) - os.system('update-locale %s 2>&1 > /dev/null' %(lang)) + + os.system('locale-gen %s' %(lang) + os.system('update-locale %s' %(lang) + + mp = {'lang' : lang } + T = Template(file="/etc/ec2-init/templates/locale.tmpl", searchList=[mp]) + f = open("/var/run/ec2/locale", "w") + f.write('%s' $(t)) + f.close() + + if not os.path.exists("/etc/default/locale-ec2-init"): + os.system("mv /etc/default/locale /etc/default/locale-ec2-init") + os.symlink("/var/run/ec2/locale", "/etc/default/locale") + os.system("source /etc/default/locale") + os.system('touch %s' %(filename)) def get_amid(): -- cgit v1.2.3