diff options
author | Chuck Short <zulcss@ubuntu.com> | 2009-03-18 20:14:26 +0000 |
---|---|---|
committer | Bazaar Package Importer <jamesw@ubuntu.com> | 2009-03-18 20:14:26 +0000 |
commit | 58f82c2220b3137c97a377b01da04a14c64b0a1d (patch) | |
tree | ec0958d5e572538923ea969b9fc9a577a0f3cf4d /debian | |
parent | 2d667f57536a532d84872404e19e777820692665 (diff) | |
download | vyos-cloud-init-58f82c2220b3137c97a377b01da04a14c64b0a1d.tar.gz vyos-cloud-init-58f82c2220b3137c97a377b01da04a14c64b0a1d.zip |
* 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.
Diffstat (limited to 'debian')
-rw-r--r-- | debian/changelog | 11 | ||||
-rw-r--r-- | debian/ec2-config.cfg | 1 | ||||
-rw-r--r-- | debian/ec2-init.rightscale-init.init | 113 | ||||
-rwxr-xr-x | debian/rules | 2 |
4 files changed, 127 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 7f8f947f..814c6a7b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +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: diff --git a/debian/ec2-config.cfg b/debian/ec2-config.cfg index 4af39f0c..cd38d598 100644 --- a/debian/ec2-config.cfg +++ b/debian/ec2-config.cfg @@ -1,2 +1,3 @@ user="ubuntu" distro="intrepid" +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..4a1c52af --- /dev/null +++ b/debian/ec2-init.rightscale-init.init @@ -0,0 +1,113 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: rightscale +# Required-Start: +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 1 +# Sort-Description: Setup Righscale + +# This script will configure an Ubuntu server for use with RightScale + +set -e + +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 sysv-rc-conf unzip ruby1.8-dev autoconf automake libtool logrotate rsync openssl ca-certificates + + ## 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=`basename $0` + init_script_name=${my_name:3} + update-rc.d -f $init_script_name remove + rm -f /etc/init.d/$init_script_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/rules b/debian/rules index dbdd8253..4d362f5b 100755 --- a/debian/rules +++ b/debian/rules @@ -12,3 +12,5 @@ build/ec2-init:: 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 + dh_installinit -p ec2-init --name rightscale-init -- defaults 20 21 |