diff options
-rw-r--r-- | debian/changelog | 15 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | debian/init | 16 | ||||
-rw-r--r-- | debian/install | 2 | ||||
-rwxr-xr-x | ec2-set-hostname.py | 12 | ||||
-rw-r--r-- | templates/hosts.tmpl | 10 | ||||
-rw-r--r-- | templates/sources.list.tmpl | 2 |
7 files changed, 43 insertions, 16 deletions
diff --git a/debian/changelog b/debian/changelog index a752af7b..94c79b83 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,18 @@ +ec2-init (0.3.3ubuntu10) jaunty; urgency=low + + * ec2-set-hostname.py: + - Use template for /etc/hosts creation. + - Dont use public_hostname in /etc/hosts. (LP: #352745) + * debian/control: + - Add python-cheetah as a depends. + * templates/sources.list.tmpl: + - Update template. + * debian/init: + - Run the ec2-user-data script last so that the users + get a stable system before running the user scripts. + + -- Chuck Short <zulcss@ubuntu.com> Wed, 01 Apr 2009 08:48:05 -0400 + ec2-init (0.3.3ubuntu9) jaunty; urgency=low * ec2-set-apt-sources.py: diff --git a/debian/control b/debian/control index 2eb50d17..05823938 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 +Depends: python, procps, python-configobj, python-cheetah 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 ea4f0acf..113d8700 100644 --- a/debian/init +++ b/debian/init @@ -38,14 +38,6 @@ case "$1" in log_end_msg 1 fi - log_daemon_msg "Running EC2 user data" - if ec2-run-user-data 2>&1 | logger -t "user-data" - then - log_end_msg 0 - else - log_end_msg 1 - fi - log_daemon_msg "Setting hostname to EC2 public_hostname" if ec2-set-hostname 2> /dev/null then @@ -61,6 +53,14 @@ case "$1" in log_end_msg 1 fi + log_daemon_msg "Running EC2 user data" + if ec2-run-user-data 2>&1 | logger -t "user-data" + then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; stop) exit 0 diff --git a/debian/install b/debian/install index c9b3c391..c2aa8811 100644 --- a/debian/install +++ b/debian/install @@ -1,2 +1,2 @@ debian/tmp/usr/sbin/* -debian/ec2-config.cfg etc/ec2-init +debian/tmp/etc/ec2-init/* diff --git a/ec2-set-hostname.py b/ec2-set-hostname.py index f12a4a30..6858a8b0 100755 --- a/ec2-set-hostname.py +++ b/ec2-set-hostname.py @@ -20,6 +20,7 @@ # import urllib import os +from Cheetah.Template import Template api_ver = '2008-02-01' metadata = None @@ -29,11 +30,10 @@ my_hostname = urllib.urlopen('%s/local-hostname/' % base_url).read() os.system('hostname %s' % my_hostname) # replace the ubuntu hostname in /etc/hosts -my_public_hostname = urllib.urlopen('%s/public-hostname/' % base_url).read() +mp = {'hostname': my_hostname} +t = Template(file="/etc/ec2-init/templates/hosts.tmpl", searchList=[mp]) -f = open("/etc/hosts", "r") -lines = f.read() +os.system("rm /etc/hosts") +f = open("/etc/hosts", "w") +f.write('%s' %(t)) f.close() -file = open("/etc/hosts", "w") -file.write(lines.replace("127.0.1.1 ubuntu. ubuntu", "127.0.1.1 "+ my_public_hostname +" "+ my_hostname)) -file.close() diff --git a/templates/hosts.tmpl b/templates/hosts.tmpl new file mode 100644 index 00000000..642e7a7e --- /dev/null +++ b/templates/hosts.tmpl @@ -0,0 +1,10 @@ +127.0.0.1 localhost +127.0.1.1 $hostname + +# The following lines are desirable for IPv6 capable hosts +::1 ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters +ff02::3 ip6-allhosts diff --git a/templates/sources.list.tmpl b/templates/sources.list.tmpl index bd999dda..59dfa959 100644 --- a/templates/sources.list.tmpl +++ b/templates/sources.list.tmpl @@ -1,4 +1,6 @@ deb $mirror $codename main universe +deb-src $mirror $codename main universe deb $mirror $codename-updates main universe +deb-src $mirror $codename-updates main universe deb http://security.ubuntu.com/ubuntu $codename-security main restricted deb-src http://security.ubuntu.com/ubuntu $codename-security main restricted |