From 14d719dc08ffada0629194ae871dbb0e0a9d3026 Mon Sep 17 00:00:00 2001 From: Mihai Prica Date: Tue, 11 Jun 2013 14:25:30 +0300 Subject: python-nova: Added initscript Signed-off-by: Mihai Prica --- .../python/python-glance/glance.init | 73 ++++++++++++++++++++++ .../python/python-glance_2013.1.bb | 15 ++++- 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 meta-openstack/recipes-devtools/python/python-glance/glance.init (limited to 'meta-openstack/recipes-devtools/python') diff --git a/meta-openstack/recipes-devtools/python/python-glance/glance.init b/meta-openstack/recipes-devtools/python/python-glance/glance.init new file mode 100644 index 0000000..7a269d6 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-glance/glance.init @@ -0,0 +1,73 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $network $syslog +# Required-Stop: $remote_fs $syslog +# Default-Stop: 0 1 6 +# Short-Description: Glance API server +# Description: OpenStack Image Service (code-named Glance) API server +### END INIT INFO + +SUFFIX=@suffix@ +DESC="glance-$SUFFIX" +DAEMON="/usr/bin/glance-$SUFFIX" +CONFIG="/etc/glance/glance-$SUFFIX.conf" +PIDFILE="/var/run/glance-$SUFFIX.pid" + +start() +{ + if [ -e $PIDFILE ]; then + PIDDIR=/proc/$(cat $PIDFILE) + if [ -d ${PIDDIR} ]; then + echo "$DESC already running." + exit 1 + else + echo "Removing stale PID file $PIDFILE" + rm -f $PIDFILE + fi + fi + + echo -n "Starting $DESC..." + + start-stop-daemon --start --quiet --background \ + --pidfile ${PIDFILE} --make-pidfile --exec ${DAEMON} \ + -- --config-file $CONFIG + + if [ $? -eq 0 ]; then + echo "done." + else + echo "failed." + fi +} + +stop() +{ + echo -n "Stopping $DESC..." + start-stop-daemon --stop --quiet --pidfile $PIDFILE + if [ $? -eq 0 ]; then + echo "done." + else + echo "failed." + fi + rm -f $PIDFILE +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|force-reload) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|force-reload|restart}" + exit 1 + ;; +esac + +exit 0 diff --git a/meta-openstack/recipes-devtools/python/python-glance_2013.1.bb b/meta-openstack/recipes-devtools/python/python-glance_2013.1.bb index b574468..99d1577 100644 --- a/meta-openstack/recipes-devtools/python/python-glance_2013.1.bb +++ b/meta-openstack/recipes-devtools/python/python-glance_2013.1.bb @@ -11,6 +11,7 @@ SRC_URI = "https://launchpad.net/glance/grizzly/${PV}/+download/${SRCNAME}-${PV} file://glance-api.conf \ file://glance-cache.conf \ file://glance-registry.conf \ + file://glance.init \ " SRC_URI[md5sum] = "cd813098ca807bed67440bb1646d0647" @@ -18,7 +19,7 @@ SRC_URI[sha256sum] = "f4deee125ee6729daee5315c6aacd9e265c3015692a62ae6aefeadbd3f S = "${WORKDIR}/${SRCNAME}-${PV}" -inherit setuptools +inherit setuptools update-rc.d do_install_append() { @@ -41,6 +42,15 @@ do_install_append() { # Create the sqlite database touch ${GLANCE_CONF_DIR}/glance.db + + if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then + install -d ${D}${sysconfdir}/init.d + sed 's:@suffix@:api:' < ${WORKDIR}/glance.init >${WORKDIR}/glance-api.init.sh + install -m 0755 ${WORKDIR}/glance-api.init.sh ${D}${sysconfdir}/init.d/glance-api + sed 's:@suffix@:registry:' < ${WORKDIR}/glance.init >${WORKDIR}/glance-registry.init.sh + install -m 0755 ${WORKDIR}/glance-registry.init.sh ${D}${sysconfdir}/init.d/glance-registry + fi + } pkg_postinst_${SRCNAME} () { @@ -98,3 +108,6 @@ RDEPENDS_${SRCNAME} = "${PN} \ RDEPENDS_${SRCNAME}-api = "${SRCNAME}" RDEPENDS_${SRCNAME}-registry = "${SRCNAME}" +INITSCRIPT_PACKAGES = "${SRCNAME}-api ${SRCNAME}-registry" +INITSCRIPT_NAME_${SRCNAME}-api = "glance-api" +INITSCRIPT_NAME_${SRCNAME}-registry = "glance-registry" -- cgit v1.2.3-54-g00ecf