diff options
-rw-r--r-- | debian/changelog | 9 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | debian/init | 7 | ||||
-rwxr-xr-x | ec2-set-apt-sources.py | 1 | ||||
-rwxr-xr-x | ec2-set-defaults.py | 24 | ||||
-rwxr-xr-x | ec2-set-hostname.py | 2 |
6 files changed, 35 insertions, 10 deletions
diff --git a/debian/changelog b/debian/changelog index ea7c4b79..d5a5f851 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +ec2-init (0.3.4ubuntu4) karmic; urgency=low + + * debian/init: Run update-motd regardless whether its a firstboot or not. + * debian/init: Fix comments (LP: #373057) + * debian/control: Add update-motd as a depends. + * ec2-set-defaults.py: Wait for network to become available. (LP: #308530) + + -- Chuck Short <zulcss@ubuntu.com> Thu, 28 May 2009 05:04:31 -0400 + ec2-init (0.3.4ubuntu3) karmic; urgency=low * debian/init: Move init script to run before ssh and regenerate the ssh diff --git a/debian/control b/debian/control index e51482e0..a2812cae 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.8.0 Package: ec2-init Architecture: i386 amd64 -Depends: python, procps, python-configobj, python-cheetah, python-apt +Depends: python, procps, python-configobj, python-cheetah, python-apt, update-motd Description: Init scripts for EC2 instances, EC2 instances need special scripts to run during initialisation to retrieve and install ssh keys and to let the user run various scripts. diff --git a/debian/init b/debian/init index 3f982be5..0f0c3767 100644 --- a/debian/init +++ b/debian/init @@ -16,7 +16,7 @@ NAME=ec2-init . /lib/lsb/init-functions -if [ ! -d /var/run/ec2 ]; then +if [ ! -d /var/ec2 ]; then mkdir /var/ec2 fi @@ -37,8 +37,11 @@ first_boot() { ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub | logger -s -t "ec2" echo "-----END SSH HOST KEY FINGERPRINTS-----" | logger -s -t "ec2" echo "#############################################################" | logger -s -t "ec2" - update-motd + /usr/sbin/update-motd touch /var/ec2/.first-boot + else + log_daemon_msg "Running update-motd" + /usr/sbin/update-motd fi } diff --git a/ec2-set-apt-sources.py b/ec2-set-apt-sources.py index 6327a78b..d48e5167 100755 --- a/ec2-set-apt-sources.py +++ b/ec2-set-apt-sources.py @@ -61,7 +61,6 @@ def updateList(filename): f.write('%s' %(t)) f.close() - if not os.path.exists("/etc/apt/sources.list-ec2-init"): os.system("mv /etc/apt/sources.list /etc/apt/sources.list-ec2-init") os.symlink("/var/ec2/sources.list", "/etc/apt/sources.list") cache = apt.Cache(apt.progress.OpProgress()) diff --git a/ec2-set-defaults.py b/ec2-set-defaults.py index c99e3f9e..410e57d8 100755 --- a/ec2-set-defaults.py +++ b/ec2-set-defaults.py @@ -21,11 +21,27 @@ import urllib import os +import socket +import time from Cheetah.Template import Template api_ver = '2008-02-01' metadata = None +def checkServer(): + for x in range(30*60): + s = socket.socket() + try: + address = '169.254.169.254' + port = 80 + s.connect((address,port)) + s.close() + return + except socket.error, e: + time.sleep(1) + +checkServer() + base_url = 'http://169.254.169.254/%s/meta-data' % api_ver zone = urllib.urlopen('%s/placement/availability-zone' % base_url).read() @@ -41,7 +57,6 @@ def set_language(location,filename): lang='en_GB.UTF-8' 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]) @@ -49,10 +64,9 @@ def set_language(location,filename): 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(". /etc/default/locale") + os.system("mv /etc/default/locale /etc/default/locale-ec2-init") + os.system("ln -s /var/ec2/locale /etc/default/locale") + os.system(". /etc/default/locale") os.system('touch %s' %(filename)) diff --git a/ec2-set-hostname.py b/ec2-set-hostname.py index c4e56fc9..108fe5da 100755 --- a/ec2-set-hostname.py +++ b/ec2-set-hostname.py @@ -52,7 +52,7 @@ def set_hostname(filename): os.system("rm /etc/hostname") f = open("/etc/hostname", "w") - f.write('%s' %(t)) + f.write('%s' %(my_hostname)) f.close() os.system('touch %s' %(filename)) |