summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
Diffstat (limited to 'debian')
-rw-r--r--debian/changelog179
-rw-r--r--debian/control6
-rw-r--r--debian/dirs3
-rw-r--r--debian/ec2-config.cfg2
-rw-r--r--debian/ec2-init.rightscale-init.init103
-rw-r--r--debian/init39
-rw-r--r--debian/install2
-rwxr-xr-xdebian/rules10
8 files changed, 328 insertions, 16 deletions
diff --git a/debian/changelog b/debian/changelog
index a0b4ab07..b45b28c5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,183 @@
+ec2-init (0.3.3ubuntu12) jaunty; urgency=low
+
+ * ec2-run-user-data.py: Fix error.
+
+ -- Chuck Short <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> Tue, 31 Mar 2009 09:37:13 -0400
+
+ec2-init (0.3.3ubuntu7) jaunty; urgency=low
+
+ * debian/rules: Fix typo.
+
+ -- Chuck Short <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> Wed, 04 Mar 2009 08:33:01 -0500
+
+ec2-init (0.3.3ubuntu3~intrepid4) intrepid; urgency=low
+
+ * set distro to intrepid.
+
+ -- Chuck Short <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> Tue, 24 Feb 2009 14:02:37 -0500
+
+ec2-init (0.3.3ubuntu1) jaunty; urgency=low
+
+ * debian/init: Fix init script.
+
+ -- Chuck Short <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> 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 <zulcss@ubuntu.com> Tue, 13 Jan 2009 15:20:21 -0500
+
ec2-init (0.1) intrepid; urgency=low
- * Initial release.
+ * Initial release (LP: #269434).
-- Soren Hansen <soren@ubuntu.com> Fri, 12 Sep 2008 15:30:32 +0200
diff --git a/debian/control b/debian/control
index c579e89e..e51482e0 100644
--- a/debian/control
+++ b/debian/control
@@ -6,8 +6,8 @@ Build-Depends: cdbs, debhelper (>= 5)
Standards-Version: 3.8.0
Package: ec2-init
-Architecture: all
-Depends: python, procps
-Description: Init scripts for EC2 instances
+Architecture: i386 amd64
+Depends: python, procps, python-configobj, python-cheetah, python-apt
+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/dirs b/debian/dirs
new file mode 100644
index 00000000..3c349733
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1,3 @@
+var/ec2
+usr/sbin
+etc/ec2-init
diff --git a/debian/ec2-config.cfg b/debian/ec2-config.cfg
new file mode 100644
index 00000000..76c81b77
--- /dev/null
+++ b/debian/ec2-config.cfg
@@ -0,0 +1,2 @@
+user="ubuntu"
+DISABLE_ROOT="1"
diff --git a/debian/ec2-init.rightscale-init.init b/debian/ec2-init.rightscale-init.init
new file mode 100644
index 00000000..10ba39d3
--- /dev/null
+++ b/debian/ec2-init.rightscale-init.init
@@ -0,0 +1,103 @@
+#!/bin/bash
+#
+# This script will configure an Ubuntu server for use with RightScale
+#
+
+start() {
+ ## First check to see if we were launched through RightScale. Exit and remove if not...
+ user_data=`curl -s -S -f -L --retry 7 -w ' %{http_code}' http://169.254.169.254/latest/user-data`
+ if `echo $user_data | grep -v "RS_token=" 1>/dev/null 2>&1` ; then
+ ## Remove this init script so that it does not run again
+ remove
+ exit 0
+ fi
+
+ ## ok, we were launched through RightScale, so let's continue
+ echo "Detected a RightScale instance..."
+ echo "Beginning configuration..."
+
+ ## figure out which version of RightScale to install...
+ export rs_release=Ubuntu_`lsb_release -rs`
+
+ ## Install some necessary packages
+ echo "Installing necessary packages..."
+ export DEBIAN_FRONTEND=NONINTERACTIVE
+ apt-get update
+ apt-get install -y binutils ruby1.8 sysv-rc-conf unzip ruby1.8-dev build-essential autoconf automake libtool logrotate rsync openssl ca-certificates libopenssl-ruby1.8
+
+ ## Add rightscale customizations
+ echo "Installing RightScale"
+ curl -s -S -f -L --retry 7 -w ' %{http_code}' -o /tmp/rightscale_scripts.tgz http://s3.amazonaws.com/rightscale_scripts/rightscale_scripts_"$rs_release".tgz
+ tar -xzf /tmp/rightscale_scripts.tgz -C /opt/
+ ln -f /opt/rightscale/etc/init.d/rightscale /etc/init.d/rightscale
+ chmod +x /opt/rightscale/etc/init.d/rightscale
+ chmod +x /etc/init.d/rightscale
+ mkdir -p /etc/rightscale.d
+ update-rc.d rightscale start 98 2 3 4 5 . stop 1 0 1 6 .
+ ln -sf /usr/bin/ruby1.8 /usr/bin/ruby
+ ln -f /opt/rightscale/etc/motd /etc/motd
+ echo $rs_release > /etc/rightscale-release
+
+ ## Add rubygems 1.8
+ echo "Installing RubyGems 1.8..."
+ curl -s -S -f -L --retry 7 -w ' %{http_code}' -o /tmp/rubygems.tgz http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
+ mkdir -p /tmp/rubygems
+ tar -xzvf /tmp/rubygems.tgz -C $root/tmp/rubygems
+ cd /tmp/rubygems/rubygems-1.3.1/
+ ruby setup.rb --no-rdoc --no-ri
+ ln -s /usr/bin/gem1.8 /usr/bin/gem
+ gem source -a http://ec2-us-east-mirror.rightscale.com/rubygems/archive/latest/
+ gem source -r http://mirror.rightscale.com
+ gem install --no-rdoc --no-ri xml-simple net-ssh net-sftp s3sync
+ updatedb
+
+ ## Add some links to keep things inline
+ ln -s /usr/lib/site_ruby/aes /usr/local/lib/site_ruby/1.8/aes
+ ln -s /usr/lib/site_ruby/ec2 /usr/local/lib/site_ruby/1.8/ec2
+ ln -s /usr/bin/env /bin/env
+
+ ## Insert 'ec2' as the cloud
+ echo "ec2" > /etc/rightscale.d/cloud
+
+ ## Enable root logins
+ echo "Enabling root logins..."
+ cp -f /home/ubuntu/.ssh/authorized_keys /root/.ssh/.
+
+ ## Remove the default sources.list becasue RightScale will create a better one anyways...
+ rm -f /etc/apt/sources.list.d/amazon.list
+
+ ## Remove this init script so that it does not run again
+ remove
+
+ ## Start the rightscale service
+ echo "Starting RightScale..."
+ /etc/init.d/rightscale start
+ echo "RightScale services started properly"
+
+}
+
+stop() {
+ exit 0
+}
+
+remove() {
+ my_name=`readlink -e $0`
+ update-rc.d -f `basename $my_name` remove
+ rm -f $my_name
+}
+
+
+# See how we were called.
+case "$1" in
+ start)
+ start >>/var/log/install 2>&1
+ ;;
+ stop)
+ stop >>/var/log/install 2>&1
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop}"
+ exit 1
+esac
+
+exit $?
diff --git a/debian/init b/debian/init
index d084c568..ea4f0acf 100644
--- a/debian/init
+++ b/debian/init
@@ -1,7 +1,7 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: ec2-init
-# Required-Start: $network $local_fs
+# Required-Start: $network $local_fs $ssh
# Required-Stop:
# Should-Start: $named
# Should-Stop:
@@ -16,10 +16,14 @@ NAME=ec2-init
. /lib/lsb/init-functions
+if [ ! -d /var/run/ec2 ]; then
+ mkdir /var/run/ec2
+fi
+
case "$1" in
start)
- log_daemon_msg "Running EC2 user data"
- if ec2-run-user-data 2> /dev/null
+ log_daemon_msg "Setting EC2 defaults"
+ if ec2-set-defaults 2> /dev/null
then
log_end_msg 0
else
@@ -34,16 +38,29 @@ case "$1" in
log_end_msg 1
fi
- if pgrep nash-hotplug > /dev/null
+ log_daemon_msg "Running EC2 user data"
+ if ec2-run-user-data 2>&1 | logger -t "user-data"
then
- log_daemon_msg "Killing nash-hotplug"
- if pkill nash-hotplug;
- then
- log_end_msg 0
- else
- log_end_msg 1
- fi
+ 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
+ log_end_msg 0
+ else
+ log_end_msg 1
+ fi
+ log_daemon_msg "Determining EC2 availability zone"
+ if ec2-set-apt-sources 2> /dev/null
+ then
+ log_end_msg 0
+ else
+ log_end_msg 1
+ fi
+
;;
stop)
exit 0
diff --git a/debian/install b/debian/install
index 54a21487..33e2382f 100644
--- a/debian/install
+++ b/debian/install
@@ -1 +1,3 @@
debian/tmp/usr/sbin/*
+debian/tmp/etc/ec2-init/templates/*
+debian/ec2-config.cfg etc/ec2-init
diff --git a/debian/rules b/debian/rules
index 8c9f1074..641694d9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,9 +2,17 @@
include /usr/share/cdbs/1/rules/debhelper.mk
-DEB_UPDATE_RCD_PARAMS:=start 90 S .
+DEB_UPDATE_RCD_PARAMS:= start 90 2 3 4 5 . stop 20 1 .
build/ec2-init::
install -d debian/tmp/usr/sbin
+ mkdir -p debian/tmp/var/ec2
+ mkdir -p debian/tmp/etc/ec2-init/templates
install -m 775 ec2-fetch-credentials.py debian/tmp/usr/sbin/ec2-fetch-credentials
install -m 775 ec2-run-user-data.py debian/tmp/usr/sbin/ec2-run-user-data
+ install -m 755 ec2-set-hostname.py debian/tmp/usr/sbin/ec2-set-hostname
+ install -m 755 ec2-set-apt-sources.py debian/tmp/usr/sbin/ec2-set-apt-sources
+ install -m755 ec2-get-info.py debian/tmp/usr/sbin/ec2-get-info
+ install -m755 ec2-set-defaults.py debian/tmp/usr/sbin/ec2-set-defaults
+ install -m755 templates/* debian/tmp/etc/ec2-init/templates
+ dh_installinit -p ec2-init --name rightscale-init -- defaults 99 09