From 611a8b701a2549f8bee10298a0a32c38e9e16cc2 Mon Sep 17 00:00:00 2001 From: Clint Byrum Date: Mon, 13 Jan 2014 12:54:42 -0800 Subject: [PATCH] Add debian-upstart for experimenting with upstart Upstart support in Debian is somewhat experimental, but having it would be especially useful for TripleO which already generates upstart scripts which will work fairly well on Debian based systems. Change-Id: I267da5ae7bc4a484fac152a14963d96ca2ad2693 --- elements/debian-upstart/README.md | 3 +++ elements/debian-upstart/element-deps | 1 + elements/debian-upstart/root.d/05-debian-upstart | 4 ++++ .../debian-upstart/root.d/20-debian-fix-upstart-jobs | 11 +++++++++++ .../debian-upstart/root.d/99-cleanup-debian-upstart | 3 +++ 5 files changed, 22 insertions(+) create mode 100644 elements/debian-upstart/README.md create mode 100644 elements/debian-upstart/element-deps create mode 100755 elements/debian-upstart/root.d/05-debian-upstart create mode 100755 elements/debian-upstart/root.d/20-debian-fix-upstart-jobs create mode 100755 elements/debian-upstart/root.d/99-cleanup-debian-upstart diff --git a/elements/debian-upstart/README.md b/elements/debian-upstart/README.md new file mode 100644 index 00000000..807bc2ee --- /dev/null +++ b/elements/debian-upstart/README.md @@ -0,0 +1,3 @@ +By default Debian will use sysvinit for booting. If you want to experiment +with Upstart, or have need of it due to a need for upstart jobs, this +element will build the image with upstart as the init system. diff --git a/elements/debian-upstart/element-deps b/elements/debian-upstart/element-deps new file mode 100644 index 00000000..2dee1753 --- /dev/null +++ b/elements/debian-upstart/element-deps @@ -0,0 +1 @@ +debian diff --git a/elements/debian-upstart/root.d/05-debian-upstart b/elements/debian-upstart/root.d/05-debian-upstart new file mode 100755 index 00000000..5e012bfc --- /dev/null +++ b/elements/debian-upstart/root.d/05-debian-upstart @@ -0,0 +1,4 @@ +#!/bin/bash +set -eux +echo upstart >> ${TARGET_ROOT}/.extra-packages +echo debian-upstart >> ${TARGET_ROOT}/.distro-name diff --git a/elements/debian-upstart/root.d/20-debian-fix-upstart-jobs b/elements/debian-upstart/root.d/20-debian-fix-upstart-jobs new file mode 100755 index 00000000..1ea1eb4b --- /dev/null +++ b/elements/debian-upstart/root.d/20-debian-fix-upstart-jobs @@ -0,0 +1,11 @@ +#!/bin/bash +set -eux +# Working around bug in Debian cloud-init packages with upstart +# where startpar will wait forever for these because they are tasks +# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=735204 +for sysv_script in cloud-init cloud-init-local cloud-config cloud-final ; do + sudo rm -f ${TARGET_ROOT}/etc/rc2.d/??${sysv_script} ${TARGET_ROOT}/etc/init.d/${sysv_script} +done +# And working around upstart job bug in Debian where cloud-config will never run +# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=735207 +sudo sed -i -e 's/start on .*/start on started rc RUNLEVEL=[2345]/' ${TARGET_ROOT}/etc/init/cloud-config.conf diff --git a/elements/debian-upstart/root.d/99-cleanup-debian-upstart b/elements/debian-upstart/root.d/99-cleanup-debian-upstart new file mode 100755 index 00000000..cd029626 --- /dev/null +++ b/elements/debian-upstart/root.d/99-cleanup-debian-upstart @@ -0,0 +1,3 @@ +#!/bin/bash +set -eux +sudo rm -f ${TARGET_ROOT}/.distro-name ${TARGET_ROOT}/.extra-packages