summaryrefslogtreecommitdiff
path: root/debian/init
diff options
context:
space:
mode:
authorSoren Hansen <soren@canonical.com>2009-08-10 21:34:47 +0200
committerSoren Hansen <soren@canonical.com>2009-08-10 21:34:47 +0200
commit1f33a10388e1ac4079d17e9b836dfb4ab7730fec (patch)
tree4260d5f37c0c3b45eba8728d48f86dbe40965461 /debian/init
parent1cac841c3365f31a6021a63407f2001cfc69c04d (diff)
downloadvyos-cloud-init-1f33a10388e1ac4079d17e9b836dfb4ab7730fec.tar.gz
vyos-cloud-init-1f33a10388e1ac4079d17e9b836dfb4ab7730fec.zip
Move ec2 init script from debian/ out into top-level.
Install init-script using distutils. Add -o to dh_installinit call to let it find the init script.
Diffstat (limited to 'debian/init')
-rw-r--r--debian/init143
1 files changed, 0 insertions, 143 deletions
diff --git a/debian/init b/debian/init
deleted file mode 100644
index b2995b79..00000000
--- a/debian/init
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/bin/sh
-### BEGIN INIT INFO
-# Provides: ec2-init
-# Required-Start: $network $local_fs $ssh
-# Required-Stop:
-# Should-Start: $named
-# Should-Stop:
-# Default-Start: S
-# Default-Stop: 1
-# Short-Description: Initialises system for use on Amazon EC2
-# Description: Fetches login credentials and handles various quirks
-### END INIT INFO
-
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
-NAME=ec2-init
-
-. /lib/lsb/init-functions
-
-if [ ! -d /var/ec2 ]; then
- mkdir /var/ec2
-fi
-
-run_once() {
- per_id=$1
- action_id=$2
-
- semaphore="/var/lib/ec2/$action_id.$per_id"
-
- if ! [ -e "$semaphore" ]
- then
- touch "$semaphore"
- return 0
- fi
- return 1
-}
-
-run_once_per_instance() {
- action_id=$1
- instance=`ec2-get-info --instance-id | cut -f2 -d\ `
- run_once $instance $action_id
-}
-
-run_once_per_ami() {
- action_id=$1
- ami=`ec2-get-info --ami-id | cut -f2 -d\ `
- run_once $ami $action_id
-}
-
-run_once_ever() {
- action_id=$1
- run_once ever $action_id
-}
-
-regenerate_ssh_host_keys() {
- rm -f /etc/ssh/ssh_host_*_key*
-
- ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N '' | logger -s -t "ec2"
- ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N '' | logger -s -t "ec2"
-
- # This allows user to get host keys securely through console log
- echo | logger -s -t "ec2"
- echo | logger -s -t "ec2"
- echo "#############################################################" | logger -s -t "ec2"
- echo "-----BEGIN SSH HOST KEY FINGERPRINTS-----" | logger -s -t "ec2"
- ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub | logger -s -t "ec2"
- 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"
-}
-
-case "$1" in
- start)
- log_daemon_msg "Waiting for EC2 meta-data service"
- if ec2-wait-for-meta-data-service
- then
- log_end_msg 0
- else
- log_end_msg 1
- exit 1
- fi
-
- if run_once_per_ami ssh_host_key_regeneration
- then
- regenerate_ssh_host_keys
- fi
-
- update-motd
-
- if run_once_ever ec2-defaults
- then
- log_daemon_msg "Setting EC2 defaults"
- if ec2-set-defaults 2> /dev/null
- then
- log_end_msg 0
- else
- log_end_msg 1
- fi
- fi
-
- if run_once_ever ssh_authorized_keys
- then
- log_daemon_msg "Fetching EC2 SSH keys"
- if ec2-fetch-credentials 2> /dev/null
- then
- log_end_msg 0
- else
- log_end_msg 1
- fi
- fi
-
- log_daemon_msg "Setting hostname to EC2 localhostname"
- if ec2-set-hostname 2> /dev/null
- then
- log_end_msg 0
- else
- log_end_msg 1
- fi
-
- if run_once_per_instance user-data
- then
- 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
- fi
- ;;
- stop)
- exit 0
- ;;
- restart|force-reload)
- exec $0 start
- ;;
- *)
- N=/etc/init.d/$NAME
- echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
- exit 1
- ;;
-esac
-
-exit 0