summaryrefslogtreecommitdiff
path: root/ec2-set-defaults.py
diff options
context:
space:
mode:
authorChuck Short <zulcss@ubuntu.com>2009-05-13 14:41:35 +0200
committerChuck Short <zulcss@ubuntu.com>2009-05-13 14:41:35 +0200
commitdd112c3afe50c75ae9b00f142b550c6e0d95f47b (patch)
treece1843820c13f3c33dd16d34929deedf16107f37 /ec2-set-defaults.py
parent322bf4c779a378f113e6bf60714c66298aba876d (diff)
downloadvyos-cloud-init-dd112c3afe50c75ae9b00f142b550c6e0d95f47b.tar.gz
vyos-cloud-init-dd112c3afe50c75ae9b00f142b550c6e0d95f47b.zip
* 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)
Diffstat (limited to 'ec2-set-defaults.py')
-rwxr-xr-xec2-set-defaults.py19
1 files changed, 15 insertions, 4 deletions
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():