--- ec2-init-0.5.0.orig/debian/pycompat +++ ec2-init-0.5.0/debian/pycompat @@ -0,0 +1 @@ +2 --- ec2-init-0.5.0.orig/debian/rules +++ ec2-init-0.5.0/debian/rules @@ -0,0 +1,9 @@ +#!/usr/bin/make -f + +DEB_PYTHON_SYSTEM=pycentral +include /usr/share/cdbs/1/class/python-distutils.mk +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/rules/patchsys-quilt.mk + +binary-install/ec2-init:: + for x in $(DEB_DESTDIR)/usr/bin/*.py; do mv "$$x" "$${x%.py}"; done --- ec2-init-0.5.0.orig/debian/copyright +++ ec2-init-0.5.0/debian/copyright @@ -0,0 +1,28 @@ +This package was debianized by Soren Hansen on +Thu, 04 Sep 2008 12:49:15 +0200. + +Upstream Author: + + Scott Moser + Soren Hansen + Chuck Short + +Copyright: + + Copyright 2008-2009 Canonical Ltd. + +License: + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License version 3, as + published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +The complete text of the GPL version 3 can be seen in /usr/share/common-licenses/GPL-3. --- ec2-init-0.5.0.orig/debian/dirs +++ ec2-init-0.5.0/debian/dirs @@ -0,0 +1,4 @@ +var/lib/cloud +usr/bin +etc/init +etc/ec2-init --- ec2-init-0.5.0.orig/debian/control +++ ec2-init-0.5.0/debian/control @@ -0,0 +1,15 @@ +Source: ec2-init +Section: admin +Priority: extra +Maintainer: Soren Hansen +Build-Depends: cdbs, debhelper (>= 5.0.38), python-all-dev (>= 2.3.5-11), python-central (>= 0.5.6), quilt +XS-Python-Version: all +Standards-Version: 3.8.0 + +Package: ec2-init +Architecture: all +Depends: python, procps, python-configobj, python-cheetah, update-motd, python-boto (>=1.9b), ${python:Depends} +XB-Python-Version: ${python:Versions} +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. --- ec2-init-0.5.0.orig/debian/changelog +++ ec2-init-0.5.0/debian/changelog @@ -0,0 +1,357 @@ +ec2-init (0.5.0-0ubuntu2) lucid; urgency=low + + * pull changes from devel branch to get functional on ec2 + + -- Scott Moser Mon, 11 Jan 2010 12:03:45 -0500 + +ec2-init (0.5.0-0ubuntu2) lucid; urgency=low + + * new upstream release + + -- Scott Moser Thu, 07 Jan 2010 22:00:38 -0500 + +ec2-init (0.4.999-0ubuntu8) lucid; urgency=low + + * fix mirror selection for us-west-1 (LP: #494185) + + -- Scott Moser Fri, 11 Dec 2009 15:12:19 -0500 + +ec2-init (0.4.999-0ubuntu7) karmic; urgency=low + + * work around differences in eucalyptus ephemeral mounts (LP: #458850) + * get 'ec2:' prefix on ssh public key fingerprint (LP: #458576) + + -- Scott Moser Mon, 26 Oct 2009 16:18:06 -0400 + +ec2-init (0.4.999-0ubuntu6) karmic; urgency=low + + * make sources.list components for 'karmic-security' the same as + 'karmic' and 'karmic-updates' (main, restricted) (LP: #457866) + + -- Scott Moser Thu, 22 Oct 2009 08:55:58 -0400 + +ec2-init (0.4.999-0ubuntu5) karmic; urgency=low + + * write regenerate_ssh_host_keys output directly to /dev/console + to ensure that it gets there. (LP: #451881) + + -- Scott Moser Wed, 21 Oct 2009 17:23:38 -0400 + +ec2-init (0.4.999-0ubuntu4) karmic; urgency=low + + * set locale to en_US.UTF-8 if get_location_from_availability_zone + doesn't have a match (LP: #407949) + + -- Scott Moser Tue, 20 Oct 2009 09:57:49 -0400 + +ec2-init (0.4.999-0ubuntu3) karmic; urgency=low + + * split running of user-data out of ec2-init into ec2-init-user-data + run this at S99. (LP : #431255) + + -- Scott Moser Fri, 25 Sep 2009 14:17:17 -0400 + +ec2-init (0.4.999-0ubuntu2) karmic; urgency=low + + * remove rightscale-init from package (see LP: #434181, LP: #434693) + * fix lintian warning, specify path to GPL-3 + * replace multiple '| logger' in regenerate_ssh_host_keys single one + * add ec2-is-compat-env, and disable init script by default. it can be + enabled by setting 'compat=1' in /etc/ec2-init/is-compat-env + + -- Scott Moser Thu, 24 Sep 2009 16:32:42 -0400 + +ec2-init (0.4.999-0ubuntu1) karmic; urgency=low + + * New upstream release + + -- Soren Hansen Wed, 26 Aug 2009 01:23:52 +0200 + +ec2-init (0.4.99-0ubuntu3) karmic; urgency=low + + * Also update /etc/default/locale when setting the locale based on + locality. + + -- Soren Hansen Tue, 11 Aug 2009 21:49:33 +0200 + +ec2-init (0.4.99-0ubuntu2) karmic; urgency=low + + * Consolidate build-dependencies a bit. + * Sync default configuration with code. + * Create /var/lib/ec2 in package. + * Make ec2-get-info more robust in testing environments. + * Handle missing public keys more gracefully. + * Set proper ownership of user's authorized_keys. + + -- Soren Hansen Tue, 11 Aug 2009 09:54:16 +0200 + +ec2-init (0.4.99-0ubuntu1) karmic; urgency=low + + * Massive rewrite. (LP: #407871, #407919, #308530, #407949, #407950, #407892 + and probably many others) + * First Ubuntu version with the upstream tarball split out. + * Switch to arch: all. There is no arch specific code here. + + -- Soren Hansen Tue, 11 Aug 2009 08:33:33 +0200 + +ec2-init (0.3.4ubuntu9) karmic; urgency=low + + * Really include the action id in the semaphore filename. + + -- Soren Hansen Sat, 11 Jul 2009 09:50:31 +0200 + +ec2-init (0.3.4ubuntu8) karmic; urgency=low + + * Add Vcs-Bzr header to debian/control. + * Include the action id in the semaphore filename. + + -- Soren Hansen Sat, 11 Jul 2009 02:35:43 +0200 + +ec2-init (0.3.4ubuntu7) karmic; urgency=low + + * Re-add accidentally removed locale template. + * Fix indentation in init script. + + -- Soren Hansen Fri, 10 Jul 2009 23:47:27 +0200 + +ec2-init (0.3.4ubuntu6) karmic; urgency=low + + * Replace calls to ec2-get-data with calls to ec2-get-info. + * Make this package arch: all. + + -- Soren Hansen Fri, 10 Jul 2009 23:16:35 +0200 + +ec2-init (0.3.4ubuntu5) karmic; urgency=low + + * debian/init: Move instance reboot detection out of python + scripts and move them to the init script. + * debian/ec2-set-defaults.py: + - Point to the right location for locate (LP: #387611) + - Default to UTC (LP: #341060) + * debian/ec2-set-apt-sources.py: If you cant contact EC2 then use the + regular archive (LP: #387027) + * debian/ec2-setup-hostname.py: Use the local hostname in /etc/hosts + and dont change once rebooted. (LP: #352745) + + -- Chuck Short Wed, 08 Jul 2009 09:48:49 -0400 + +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 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 + 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. + + -- Chuck Short Thu, 14 May 2009 11:11:49 -0400 + +ec2-init (0.3.4ubuntu2) karmic; urgency=low + + * 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) + + -- Chuck Short Wed, 13 May 2009 13:41:35 -0400 + +ec2-init (0.3.4ubuntu1) karmic; urgency=low + + * Add more smarts to ec2 instance bring up. (LP: #371936) + + -- Chuck Short Tue, 05 May 2009 08:59:54 -0400 + +ec2-init (0.3.3ubuntu12) jaunty; urgency=low + + * ec2-run-user-data.py: Fix error. + + -- Chuck Short Tue, 07 Apr 2009 08:14:07 -0400 + +ec2-init (0.3.3ubuntu11) jaunty; urgency=low + + * debian/control: + - Add python-cheetah and python-apt as a dependency. + * debian/ec2-config.cfg: + - Remove distro due to the change in ec2-set-apt-sources.py + * debian/inistall + - Install the templates in the right place. + * ec2-set-apt-sources.py: + - Use python-apt to update the sources.list. + + -- Chuck Short Wed, 01 Apr 2009 13:58:43 -0400 + +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) + + -- Chuck Short Wed, 01 Apr 2009 08:48:05 -0400 + +ec2-init (0.3.3ubuntu9) jaunty; urgency=low + + * ec2-set-apt-sources.py: + - Use a template to generate the sources.list and generate it based on the lsb_release. + + -- Chuck Short Tue, 31 Mar 2009 15:15:55 -0400 + +ec2-init (0.3.3ubuntu8) jaunty; urgency=low + + * ec2-set-apt-sources.py: + - Add the ubuntu-on-ec2 ppa. + + -- Chuck Short Tue, 31 Mar 2009 09:37:13 -0400 + +ec2-init (0.3.3ubuntu7) jaunty; urgency=low + + * debian/rules: Fix typo. + + -- Chuck Short Sun, 22 Mar 2009 17:14:16 -0400 + +ec2-init (0.3.3ubuntu6) jaunty; urgency=low + + * Set the configuration file to jaunty. + * ec2-fetch-credentials: Fix typo. + * ec2-set-defaults.py: + - Remove timezone change when booting the instance. + - Redirect output to /dev/null. + * ec2-set-apt-sources.py: + - Run apt-get update after the /etc/apt/sources.list and + redirect the output to /dev/null. + * rightscale-init: Updated rightscale-init + + -- Chuck Short Thu, 19 Mar 2009 20:52:59 -0400 + +ec2-init (0.3.3ubuntu5) jaunty; urgency=low + + * debian/ec2-config.cfg: + - Add disable root option. + * debian/ec2-init.rightscale-init.init: + - Add rightscale detection script. + * ec2-get-info.py: + - Display the information about an AMI instance. + + -- Chuck Short Mon, 16 Mar 2009 08:54:49 -0400 + +ec2-init (0.3.3ubuntu4) jaunty; urgency=low + + * ec2-fetch-credentials.py: + - Allow user to choose which user they wish to configure for. + - Allow user to disable root user if they wish to. + * ec2-set-defaults.py: + - Set default timezone to UTC. + - Set locale depending on zone. + * debian/init: + - Removed nash plugin. + - Add ec2-set-defaults. + + -- Chuck Short Wed, 04 Mar 2009 08:33:01 -0500 + +ec2-init (0.3.3ubuntu3~intrepid4) intrepid; urgency=low + + * set distro to intrepid. + + -- Chuck Short Thu, 26 Feb 2009 10:28:06 -0500 + +ec2-init (0.3.3ubuntu3) jaunty; urgency=low + + * debian/ec2-init: Log results of ec2-run-user-data to syslog. + * ec2-run-user-data.py :Dont leave files around and log the + output to syslog. + + -- Chuck Short Thu, 26 Feb 2009 10:24:35 -0500 + +ec2-init (0.3.3ubuntu2) jaunty; urgency=low + + * ec2-set-apt-sources.py: + - Use the ec2 mirrors. (LP: #317065, #333897) + - Update the /etc/apt/sources.list (LP: #333904) + * ec2-fetch-credentials.py: + - Better error checking (LP: #325067) + + -- Chuck Short Tue, 24 Feb 2009 14:02:37 -0500 + +ec2-init (0.3.3ubuntu1) jaunty; urgency=low + + * debian/init: Fix init script. + + -- Chuck Short Fri, 20 Feb 2009 09:22:54 -0500 + +ec2-init (0.3.3) jaunty; urgency=low + + * ec2-set-apt-sources.py + - Determine the zone that the user is in and generate + a /etc/apt/sources.list.d/ based on that. + * debian/init: + - Check to see if there is an /var/run/ec2 and create + it if it doesnt exist. + - Start ec2-set-apt-sources at first bootup. + * debian/rules: + - Install ec2-set-apt-sources. + * debian/control: + - Add python-configobj as a dependency. + * debian/{install,dirs} + - Create an /etc/ec2-init to read the configuration file and install it. + + -- Chuck Short Mon, 09 Feb 2009 10:35:56 -0500 + +ec2-init (0.3.2) jaunty; urgency=low + + * debian/init: + - Remove already ran detection + - Log the running of ec2-run-user-data to /var/log/ec2-user-data.log + * ec2-set-hostname.py: + - set hostname to the Ec2 local-hostname + - Update the /etc/hosts to change the ubuntu hostname to the + public hostname. + * ec2-fetch-credentials: + - Copy the ssh keys to the ubuntu user. + - Setup authorized keys for root to tell the user to login as the + ubuntu user when they try to connect. + * ec2-run-user-data: + - Create an .already-ran file to check to see if ec2-run-user-data + already ran. + - Save the ec2-run-user-data script in /var/ec2. + + -- Chuck Short Wed, 04 Feb 2009 09:32:08 -0500 + +ec2-init (0.3.1) jaunty; urgency=low + + * debian/dir: Install /var/ec2 to save user-data scripts. + * debian/rules: Start ec2-init after ssh. + * ec2-run-user-data.py: Save run-user-data script with ami-id. + + -- Chuck Short Mon, 26 Jan 2009 10:40:52 -0500 + +ec2-init (0.3) jaunty; urgency=low + + * ec2-run-user-data: Fix python error when writing a file to the disk. + + -- Chuck Short Thu, 15 Jan 2009 11:49:08 -0500 + +ec2-init (0.2) jaunty; urgency=low + + * debian/init: Run fetch-credentials before anything else. + (LP: #308533) + * Add ec2-set-hostname.py: Queries ec2 metdada for public-hostname + and then sets it (LP: #316201) + + -- Chuck Short Tue, 13 Jan 2009 15:20:21 -0500 + +ec2-init (0.1) intrepid; urgency=low + + * Initial release (LP: #269434). + + -- Soren Hansen Fri, 12 Sep 2008 15:30:32 +0200 + --- ec2-init-0.5.0.orig/debian/compat +++ ec2-init-0.5.0/debian/compat @@ -0,0 +1 @@ +5 --- ec2-init-0.5.0.orig/debian/patches/fixes-0.5.0.diff +++ ec2-init-0.5.0/debian/patches/fixes-0.5.0.diff @@ -0,0 +1,149 @@ +Index: ec2-init.pkg2/ec2-init.py +=================================================================== +--- ec2-init.pkg2.orig/ec2-init.py 2010-01-11 14:00:22.896201350 -0500 ++++ ec2-init.pkg2/ec2-init.py 2010-01-11 14:00:43.333703588 -0500 +@@ -32,7 +32,7 @@ + cloud.sem_and_run("consume_userdata", "once-per-instance", + cloud.consume_userdata,[],False) + except: +- warn("consuming user data failed!") ++ warn("consuming user data failed!\n") + raise + + # set the defaults (like what ec2-set-defaults.py did) +@@ -40,7 +40,7 @@ + generate_sources_list(cloud.get_mirror()) + apply_locale(cloud.get_locale()) + except: +- warn("failed to set defaults") ++ warn("failed to set defaults\n") + + # set the ssh keys up + cloud.apply_credentials() +Index: ec2-init.pkg2/ec2init/DataSourceEc2.py +=================================================================== +--- ec2-init.pkg2.orig/ec2init/DataSourceEc2.py 2010-01-11 14:00:22.866206069 -0500 ++++ ec2-init.pkg2/ec2init/DataSourceEc2.py 2010-01-11 14:00:43.333703588 -0500 +@@ -22,8 +22,8 @@ + + def get_data(self): + try: +- udf = open(self.cachedir + "/user-data.pkl") +- self.userdata_raw = cPickle.load(udf) ++ udf = open(self.cachedir + "/user-data.raw") ++ self.userdata_raw = udf.read() + udf.close() + + mdf = open(self.cachedir + "/meta-data.pkl") +@@ -37,8 +37,9 @@ + try: + if not self.wait_for_metadata_service(): + return False +- self.metadata = boto.utils.get_instance_userdata(api_ver) +- self.userdata_raw = boto.utils.get_instance_metadata(api_ver) ++ self.userdata_raw = boto.utils.get_instance_userdata(self.api_ver) ++ self.metadata = boto.utils.get_instance_metadata(self.api_ver) ++ return True + except Exception as e: + print e + return False +@@ -54,8 +55,8 @@ + + def get_locale(self): + az = self.metadata['placement']['availability-zone'] +- if self.location_locale_map.has_key[az[0:2]]: +- return(self.location_locale_map[az]) ++ if self.location_locale_map.has_key(az[0:2]): ++ return(self.location_locale_map[az[0:2]]) + else: + return(self.location_locale_map["default"]) + +Index: ec2-init.pkg2/ec2init/__init__.py +=================================================================== +--- ec2-init.pkg2.orig/ec2init/__init__.py 2010-01-11 14:00:22.876202749 -0500 ++++ ec2-init.pkg2/ec2init/__init__.py 2010-01-11 14:00:43.333703588 -0500 +@@ -80,7 +80,7 @@ + s = source() + if s.get_data(): + self.datasource = s +- return ++ return True + except Exception as e: + pass + raise Exception("Could not find data source") +@@ -93,13 +93,8 @@ + self.store_userdata() + + def store_userdata(self): +- f = open(userdata_raw,"wb") +- f.write(self.datasource.get_userdata_raw()) +- f.close() +- +- f = open(userdata,"wb") +- f.write(self.get_userdata()) +- f.close() ++ write_file(userdata_raw, self.datasource.get_userdata_raw(), 0644) ++ write_file(userdata, self.datasource.get_userdata(), 0644) + + def get_cfg_option_bool(self, key, default=None): + val = self.config.get(key, default) +Index: ec2-init.pkg2/upstart/cloud-run-user-script.conf +=================================================================== +--- ec2-init.pkg2.orig/upstart/cloud-run-user-script.conf 2010-01-11 14:00:22.916202991 -0500 ++++ ec2-init.pkg2/upstart/cloud-run-user-script.conf 2010-01-11 14:00:43.333703588 -0500 +@@ -3,12 +3,15 @@ + + description "execute cloud user scripts" + +-start on stopped rc RUNLEVEL=[2345] ++start on (stopped ec2init and stopped rc RUNLEVEL=[2345]) + console output + task + ++pre-start script ++[ -d /var/lib/cloud/data/scripts ] || mkdir -p /var/lib/cloud/data/scripts ++end script ++ + script +-sdir=/var/lib/cloud/data/scripts +-[ -d "$sdir" ] || exit 0 +-exec cloud-init-run-module once_per_ami user-scripts execute run-parts "$sdir" ++exec cloud-init-run-module once-per-instance user-scripts execute \ ++ run-parts --regex '.*' /var/lib/cloud/data/scripts + end script +Index: ec2-init.pkg2/ec2init/UserDataHandler.py +=================================================================== +--- ec2-init.pkg2.orig/ec2init/UserDataHandler.py 2010-01-11 14:00:22.886205150 -0500 ++++ ec2-init.pkg2/ec2init/UserDataHandler.py 2010-01-11 14:00:57.413703709 -0500 +@@ -40,15 +40,17 @@ + # multipart/* are just containers + if part.get_content_maintype() == 'multipart': + continue +- ctype = part.get_content_type() + + payload = part.get_payload() + ++ ctype = None ++ for str, gtype in starts_with_mappings.items(): ++ if payload.startswith(str): ++ ctype = gtype ++ break ++ + if ctype is None: +- ctype = 'application/octet-stream' +- for str, gtype in starts_with_mappings.items(): +- if payload.startswith(str): +- ctype = gtype ++ ctype = part.get_content_type() + + if ctype == 'text/x-include-url': + do_include(payload,parts) +@@ -118,7 +120,7 @@ + + if __name__ == "__main__": + import sys +- data = file(sys.argv[1]).read() ++ data = decomp_str(file(sys.argv[1]).read()) + parts = { } + process_includes(email.message_from_string(data),parts) + print "#found %s parts" % len(parts['content']) --- ec2-init-0.5.0.orig/debian/patches/series +++ ec2-init-0.5.0/debian/patches/series @@ -0,0 +1 @@ +fixes-0.5.0.diff