summaryrefslogtreecommitdiff
path: root/ec2-set-defaults.py
diff options
context:
space:
mode:
authorChuck Short <zulcss@ubuntu.com>2009-05-14 12:11:49 +0200
committerChuck Short <zulcss@ubuntu.com>2009-05-14 12:11:49 +0200
commitebfb2ed46dc72aa78e1477607ccf77b1f552fcf0 (patch)
tree43ac6c2aa8d16a1f6d8d9fbf596605a4a9c1c32a /ec2-set-defaults.py
parentdd112c3afe50c75ae9b00f142b550c6e0d95f47b (diff)
downloadvyos-cloud-init-ebfb2ed46dc72aa78e1477607ccf77b1f552fcf0.tar.gz
vyos-cloud-init-ebfb2ed46dc72aa78e1477607ccf77b1f552fcf0.zip
* debian/init: Move init script to run before ssh and regenerate the ssh
host kes in the init script rather than /etc/rc.local (LP: #370628) * ec2-set-apt-sources.py: - Move sources.list to /var/ec2 so it doesnt get removed after user reboots. * ec2-set-defaults.py: - Move locale to /var/ec2/ so it doesnt get remove after user reboots. * ec2-set-hostname.py - Create an /etc/hostname as well.
Diffstat (limited to 'ec2-set-defaults.py')
-rwxr-xr-xec2-set-defaults.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/ec2-set-defaults.py b/ec2-set-defaults.py
index 75a2f5c8..c99e3f9e 100755
--- a/ec2-set-defaults.py
+++ b/ec2-set-defaults.py
@@ -21,6 +21,7 @@
import urllib
import os
+from Cheetah.Template import Template
api_ver = '2008-02-01'
metadata = None
@@ -34,26 +35,26 @@ elif zone.startswith("eu"):
archive = "http://eu.ec2.archive.ubuntu.com/ubuntu"
def set_language(location,filename):
- if location.startswith("us"):
- lang='en_US.UTF-8'
- elif location.startswith("eu"):
- lang='en_GB.UTF-8'
+ if location.startswith("us"):
+ lang='en_US.UTF-8'
+ elif location.startswith("eu"):
+ lang='en_GB.UTF-8'
- os.system('locale-gen %s' %(lang)
- os.system('update-locale %s' %(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 = open("/var/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(". /etc/default/locale")
- os.system('touch %s' %(filename))
+ os.system('touch %s' %(filename))
def get_amid():
url = 'http://169.254.169.254/%s/meta-data' % api_ver