From 29131161eb69485f1d0b83a54ceb874d7c6d8897 Mon Sep 17 00:00:00 2001
From: Thomas Goirand <thomas@goirand.fr>
Date: Fri, 3 Oct 2014 13:27:02 +0800
Subject: [PATCH] Switching to templated init scripts using openstack-pkg-tools
 >= 13.

Rewritten-From: e8df581b4d5987b9e53395ee1417de68caffe34e
---
 trusty/debian/changelog                   |   6 ++
 trusty/debian/cinder-api.init             | 107 ----------------------
 trusty/debian/cinder-api.init.in          |  21 +++++
 trusty/debian/cinder-api.service          |  17 ----
 trusty/debian/cinder-api.upstart.in       |  26 ------
 trusty/debian/cinder-backup.init          | 106 ---------------------
 trusty/debian/cinder-backup.init.in       |  20 ++++
 trusty/debian/cinder-backup.service       |  17 ----
 trusty/debian/cinder-backup.upstart.in    |  26 ------
 trusty/debian/cinder-scheduler.init       | 107 ----------------------
 trusty/debian/cinder-scheduler.init.in    |  21 +++++
 trusty/debian/cinder-scheduler.service    |  17 ----
 trusty/debian/cinder-scheduler.upstart.in |  26 ------
 trusty/debian/cinder-volume.init          | 101 --------------------
 trusty/debian/cinder-volume.init.in       |  21 +++++
 trusty/debian/cinder-volume.service       |  17 ----
 trusty/debian/cinder-volume.upstart.in    |  26 ------
 trusty/debian/control                     |   6 +-
 trusty/debian/rules                       |   2 +-
 19 files changed, 93 insertions(+), 597 deletions(-)
 delete mode 100644 trusty/debian/cinder-api.init
 create mode 100644 trusty/debian/cinder-api.init.in
 delete mode 100644 trusty/debian/cinder-api.service
 delete mode 100644 trusty/debian/cinder-api.upstart.in
 delete mode 100644 trusty/debian/cinder-backup.init
 create mode 100644 trusty/debian/cinder-backup.init.in
 delete mode 100644 trusty/debian/cinder-backup.service
 delete mode 100644 trusty/debian/cinder-backup.upstart.in
 delete mode 100644 trusty/debian/cinder-scheduler.init
 create mode 100644 trusty/debian/cinder-scheduler.init.in
 delete mode 100644 trusty/debian/cinder-scheduler.service
 delete mode 100644 trusty/debian/cinder-scheduler.upstart.in
 delete mode 100644 trusty/debian/cinder-volume.init
 create mode 100644 trusty/debian/cinder-volume.init.in
 delete mode 100644 trusty/debian/cinder-volume.service
 delete mode 100644 trusty/debian/cinder-volume.upstart.in

diff --git a/trusty/debian/changelog b/trusty/debian/changelog
index 4f65a6fdc..89426bbe0 100644
--- a/trusty/debian/changelog
+++ b/trusty/debian/changelog
@@ -1,3 +1,9 @@
+cinder (2014.2~rc1-2) UNRELEASED; urgency=medium
+
+  * Switching to templated init scripts using openstack-pkg-tools >= 13.
+
+ -- Thomas Goirand <zigo@debian.org>  Fri, 03 Oct 2014 13:31:35 +0800
+
 cinder (2014.2~rc1-1) experimental; urgency=medium
 
   * New upstream release.
diff --git a/trusty/debian/cinder-api.init b/trusty/debian/cinder-api.init
deleted file mode 100644
index d50d4ad36..000000000
--- a/trusty/debian/cinder-api.init
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/bin/sh
-### BEGIN INIT INFO
-# Provides:          cinder-api
-# Required-Start:    $network $local_fs $remote_fs $syslog
-# Required-Stop:     $remote_fs
-# Should-Start:      postgresql mysql keystone rabbitmq-server ntp
-# Should-Stop:       postgresql mysql keystone rabbitmq-server ntp
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Cinder Api
-# Description:       Provides EBS like storage for your
-#                    virtual machine instances
-### END INIT INFO
-
-# Author: Julien Danjou <acid@debian.org>, Thomas Goirand <zigo@debian.org>
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="OpenStack Cinder Api"
-NAME=cinder-api
-DAEMON=/usr/bin/cinder-api
-DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf"
-PIDFILE=/var/run/cinder/$NAME.pid
-SCRIPTNAME=/etc/init.d/$NAME
-CINDER_USER=cinder
-LOCK_DIR=/var/lock/cinder/
-
-# Exit if the package is not installed
-[ -x $DAEMON ] || exit 0
-
-mkdir -p ${LOCK_DIR} /var/run/cinder
-chown ${CINDER_USER} ${LOCK_DIR} /var/run/cinder
-
-. /lib/lsb/init-functions
-
-[ -r /etc/default/openstack ] && . /etc/default/openstack
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
-[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/cinder/cinder-api.log"
-
-do_start(){
-	start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \
-		|| return 1
-	start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON -- \
-		$DAEMON_ARGS \
-		|| return 2
-}
-
-do_stop() {
-	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
-	RETVAL="$?"
-	rm -f $PIDFILE
-	return "$RETVAL"
-}
-
-case "$1" in
-start)
-	log_daemon_msg "Starting $DESC" "$NAME"
-	do_start
-	case "$?" in
-		0|1) log_end_msg 0 ;;
-		2) log_end_msg 1 ;;
-	esac
-;;
-stop)
-	log_daemon_msg "Stopping $DESC" "$NAME"
-	do_stop
-	case "$?" in
-		0|1) log_end_msg 0 ;;
-		2) log_end_msg 1 ;;
-	esac
-;;
-status)
-	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
-;;
-systemd-start)
-    do_start
-;;
-systemd-stop)
-    do_stop
-;;
-restart|force-reload)
-	log_daemon_msg "Restarting $DESC" "$NAME"
-	do_stop
-	case "$?" in
-	0|1)
-		do_start
-		case "$?" in
-			0) log_end_msg 0 ;;
-			1) log_end_msg 1 ;; # Old process is still running
-			*) log_end_msg 1 ;; # Failed to start
-		esac
-	;;
-	*)
-		# Failed to stop
-		log_end_msg 1
-	;;
-	esac
-;;
-*)
-	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
-	exit 3
-;;
-esac
-
-exit 0
diff --git a/trusty/debian/cinder-api.init.in b/trusty/debian/cinder-api.init.in
new file mode 100644
index 000000000..a3eaf8edc
--- /dev/null
+++ b/trusty/debian/cinder-api.init.in
@@ -0,0 +1,21 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          cinder-api
+# Required-Start:    $network $local_fs $remote_fs $syslog
+# Required-Stop:     $remote_fs
+# Should-Start:      postgresql mysql keystone rabbitmq-server ntp
+# Should-Stop:       postgresql mysql keystone rabbitmq-server ntp
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Cinder Api
+# Description:       Provides EBS like storage for your
+#                    virtual machine instances
+### END INIT INFO
+
+# Author: Julien Danjou <acid@debian.org>, Thomas Goirand <zigo@debian.org>
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="OpenStack Cinder Api"
+PROJECT_NAME=cinder
+NAME=${PROJECT_NAME}-api
diff --git a/trusty/debian/cinder-api.service b/trusty/debian/cinder-api.service
deleted file mode 100644
index ce3dded87..000000000
--- a/trusty/debian/cinder-api.service
+++ /dev/null
@@ -1,17 +0,0 @@
-[Unit]
-Description=OpenStack Cinder Api
-Documentation=http://docs.openstack.org/
-After=postgresql.service mysql.service keystone.service rabbitmq-server.service ntp.service network.service
-
-[Service]
-User=cinder
-Group=cinder
-ExecStart=/etc/init.d/cinder-api systemd-start
-ExecStop=/etc/init.d/cinder-api systemd-stop
-PIDFile=/var/run/cinder/cinder-api.pid
-Restart=on-failure
-Type=forking
-
-[Install]
-WantedBy=multi-user.target
-
diff --git a/trusty/debian/cinder-api.upstart.in b/trusty/debian/cinder-api.upstart.in
deleted file mode 100644
index 0a321da32..000000000
--- a/trusty/debian/cinder-api.upstart.in
+++ /dev/null
@@ -1,26 +0,0 @@
-description "Cinder api server"
-author "Chuck Short <zulcss@ubuntu.com>"
-
-start on runlevel [2345]
-stop on runlevel [!2345]
-
-chdir /var/run
-
-pre-start script
-    mkdir -p /var/run/cinder
-    chown cinder:cinder /var/run/cinder
-
-    mkdir -p /var/lock/cinder
-    chown cinder:root /var/lock/cinder
-end script
-
-script
-	[ -r /etc/default/openstack ] && . /etc/default/openstack
-	[ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB
-
-	[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
-	[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file /var/log/cinder/$UPSTART_JOB.log"
-
-	exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-api -- \
-	                       --config-file=/etc/cinder/cinder.conf $DAEMON_ARGS
-end script
diff --git a/trusty/debian/cinder-backup.init b/trusty/debian/cinder-backup.init
deleted file mode 100644
index d7f2b6cb9..000000000
--- a/trusty/debian/cinder-backup.init
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/bin/sh
-### BEGIN INIT INFO
-# Provides:          cinder-backup
-# Required-Start:    $network $local_fs $remote_fs $syslog
-# Required-Stop:     $remote_fs
-# Should-Start:      postgresql mysql keystone rabbitmq-server ntp
-# Should-Stop:       postgresql mysql keystone rabbitmq-server ntp
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Cinder Backup
-# Description:       Provides Cinder Backup
-### END INIT INFO
-
-# Author: Thomas Goirand <zigo@debian.org>
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="OpenStack Cinder Backup"
-NAME=cinder-backup
-DAEMON=/usr/bin/cinder-backup
-DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf"
-PIDFILE=/var/run/cinder/$NAME.pid
-SCRIPTNAME=/etc/init.d/$NAME
-CINDER_USER=cinder
-LOCK_DIR=/var/lock/cinder/
-
-# Exit if the package is not installed
-[ -x $DAEMON ] || exit 0
-
-mkdir -p ${LOCK_DIR} /var/run/cinder
-chown ${CINDER_USER} ${LOCK_DIR} /var/run/cinder
-
-. /lib/lsb/init-functions
-
-[ -r /etc/default/openstack ] && . /etc/default/openstack
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
-[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/cinder/cinder-backup.log"
-
-do_start() {
-	start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \
-		|| return 1
-	start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON -- \
-		$DAEMON_ARGS \
-		|| return 2
-}
-
-do_stop() {
-	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
-	RETVAL="$?"
-	rm -f $PIDFILE
-	return "$RETVAL"
-}
-
-case "$1" in
-start)
-	log_daemon_msg "Starting $DESC" "$NAME"
-	do_start
-	case "$?" in
-		0|1) log_end_msg 0 ;;
-		2) log_end_msg 1 ;;
-	esac
-;;
-stop)
-	log_daemon_msg "Stopping $DESC" "$NAME"
-	do_stop
-	case "$?" in
-		0|1) log_end_msg 0 ;;
-		2) log_end_msg 1 ;;
-	esac
-;;
-status)
-	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
-;;
-systemd-start)
-    do_start
-;;
-systemd-stop)
-    do_stop
-;;
-restart|force-reload)
-	log_daemon_msg "Restarting $DESC" "$NAME"
-	do_stop
-	case "$?" in
-	0|1)
-		do_start
-		case "$?" in
-			0) log_end_msg 0 ;;
-			1) log_end_msg 1 ;; # Old process is still running
-			*) log_end_msg 1 ;; # Failed to start
-		esac
-		;;
-	*)
-		# Failed to stop
-		log_end_msg 1
-		;;
-	esac
-;;
-*)
-	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
-	exit 3
-;;
-esac
-
-exit 0
diff --git a/trusty/debian/cinder-backup.init.in b/trusty/debian/cinder-backup.init.in
new file mode 100644
index 000000000..8ac22037b
--- /dev/null
+++ b/trusty/debian/cinder-backup.init.in
@@ -0,0 +1,20 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          cinder-backup
+# Required-Start:    $network $local_fs $remote_fs $syslog
+# Required-Stop:     $remote_fs
+# Should-Start:      postgresql mysql keystone rabbitmq-server ntp
+# Should-Stop:       postgresql mysql keystone rabbitmq-server ntp
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Cinder Backup
+# Description:       Provides Cinder Backup
+### END INIT INFO
+
+# Author: Thomas Goirand <zigo@debian.org>
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="OpenStack Cinder Backup"
+PROJECT_NAME=cinder
+NAME=${PROJECT_NAME}-backup
diff --git a/trusty/debian/cinder-backup.service b/trusty/debian/cinder-backup.service
deleted file mode 100644
index 6ba554f12..000000000
--- a/trusty/debian/cinder-backup.service
+++ /dev/null
@@ -1,17 +0,0 @@
-[Unit]
-Description=OpenStack Cinder Backup
-Documentation=http://docs.openstack.org/
-After=postgresql.service mysql.service keystone.service rabbitmq-server.service ntp.service network.service
-
-[Service]
-User=cinder
-Group=cinder
-ExecStart=/etc/init.d/cinder-backup systemd-start
-ExecStop=/etc/init.d/cinder-backup systemd-stop
-PIDFile=/var/run/cinder/cinder-backup.pid
-Restart=on-failure
-Type=forking
-
-[Install]
-WantedBy=multi-user.target
-
diff --git a/trusty/debian/cinder-backup.upstart.in b/trusty/debian/cinder-backup.upstart.in
deleted file mode 100644
index a154f8898..000000000
--- a/trusty/debian/cinder-backup.upstart.in
+++ /dev/null
@@ -1,26 +0,0 @@
-description "Cinder backup server"
-author "Chuck Short <zulcss@ubuntu.com>"
-
-start on runlevel [2345]
-stop on runlevel [!2345]
-
-chdir /var/run
-
-pre-start script
-    mkdir -p /var/run/cinder
-    chown cinder:cinder /var/run/cinder
-
-    mkdir -p /var/lock/cinder
-    chown cinder:root /var/lock/cinder
-end script
-
-script
-	[ -r /etc/default/openstack ] && . /etc/default/openstack
-	[ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB
-
-	[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
-	[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file /var/log/cinder/$UPSTART_JOB.log"
-
-	exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-backup -- \
-	                       --config-file=/etc/cinder/cinder.conf $DAEMON_ARGS
-end script
diff --git a/trusty/debian/cinder-scheduler.init b/trusty/debian/cinder-scheduler.init
deleted file mode 100644
index 63806a9ad..000000000
--- a/trusty/debian/cinder-scheduler.init
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/bin/sh
-### BEGIN INIT INFO
-# Provides:          cinder-scheduler
-# Required-Start:    $network $local_fs $remote_fs $syslog
-# Required-Stop:     $remote_fs
-# Should-Start:      postgresql mysql keystone rabbitmq-server ntp
-# Should-Stop:       postgresql mysql keystone rabbitmq-server ntp
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Cinder Scheduler
-# Description:       Provides EBS like storage for your
-#                    virtual machine instances
-### END INIT INFO
-
-# Author: Julien Danjou <acid@debian.org>, Thomas Goirand <zigo@debian.org>
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="OpenStack Cinder Scheduler"
-NAME=cinder-scheduler
-DAEMON=/usr/bin/cinder-scheduler
-DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf"
-PIDFILE=/var/run/cinder/$NAME.pid
-SCRIPTNAME=/etc/init.d/$NAME
-CINDER_USER=cinder
-LOCK_DIR=/var/lock/cinder/
-
-# Exit if the package is not installed
-[ -x $DAEMON ] || exit 0
-
-mkdir -p ${LOCK_DIR} /var/run/cinder
-chown ${CINDER_USER} ${LOCK_DIR} /var/run/cinder
-
-. /lib/lsb/init-functions
-
-[ -r /etc/default/openstack ] && . /etc/default/openstack
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
-[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/cinder/cinder-scheduler.log"
-
-do_start() {
-	start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \
-		|| return 1
-	start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON -- \
-		$DAEMON_ARGS \
-		|| return 2
-}
-
-do_stop() {
-	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
-	RETVAL="$?"
-	rm -f $PIDFILE
-	return "$RETVAL"
-}
-
-case "$1" in
-start)
-	log_daemon_msg "Starting $DESC" "$NAME"
-	do_start
-	case "$?" in
-		0|1) log_end_msg 0 ;;
-		2) log_end_msg 1 ;;
-	esac
-;;
-stop)
-	log_daemon_msg "Stopping $DESC" "$NAME"
-	do_stop
-	case "$?" in
-		0|1) log_end_msg 0 ;;
-		2) log_end_msg 1 ;;
-	esac
-;;
-status)
-	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
-;;
-systemd-start)
-    do_start
-;;
-systemd-stop)
-    do_stop
-;;
-restart|force-reload)
-	log_daemon_msg "Restarting $DESC" "$NAME"
-	do_stop
-	case "$?" in
-		0|1)
-		do_start
-		case "$?" in
-			0) log_end_msg 0 ;;
-			1) log_end_msg 1 ;; # Old process is still running
-			*) log_end_msg 1 ;; # Failed to start
-		esac
-	;;
-	*)
-		# Failed to stop
-		log_end_msg 1
-	;;
-	esac
-;;
-*)
-	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
-	exit 3
-;;
-esac
-
-exit 0
diff --git a/trusty/debian/cinder-scheduler.init.in b/trusty/debian/cinder-scheduler.init.in
new file mode 100644
index 000000000..c5caa292e
--- /dev/null
+++ b/trusty/debian/cinder-scheduler.init.in
@@ -0,0 +1,21 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          cinder-scheduler
+# Required-Start:    $network $local_fs $remote_fs $syslog
+# Required-Stop:     $remote_fs
+# Should-Start:      postgresql mysql keystone rabbitmq-server ntp
+# Should-Stop:       postgresql mysql keystone rabbitmq-server ntp
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Cinder Scheduler
+# Description:       Provides EBS like storage for your
+#                    virtual machine instances
+### END INIT INFO
+
+# Author: Julien Danjou <acid@debian.org>, Thomas Goirand <zigo@debian.org>
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="OpenStack Cinder Scheduler"
+PROJECT_NAME=cinder
+NAME=${PROJECT_NAME}-scheduler
diff --git a/trusty/debian/cinder-scheduler.service b/trusty/debian/cinder-scheduler.service
deleted file mode 100644
index 52afe44ec..000000000
--- a/trusty/debian/cinder-scheduler.service
+++ /dev/null
@@ -1,17 +0,0 @@
-[Unit]
-Description=OpenStack Cinder Scheduler
-Documentation=http://docs.openstack.org/
-After=postgresql.service mysql.service keystone.service rabbitmq-server.service ntp.service network.service
-
-[Service]
-User=cinder
-Group=cinder
-ExecStart=/etc/init.d/cinder-scheduler systemd-start
-ExecStop=/etc/init.d/cinder-scheduler systemd-stop
-PIDFile=/var/run/cinder/cinder-scheduler.pid
-Restart=on-failure
-Type=forking
-
-[Install]
-WantedBy=multi-user.target
-
diff --git a/trusty/debian/cinder-scheduler.upstart.in b/trusty/debian/cinder-scheduler.upstart.in
deleted file mode 100644
index ce22933b2..000000000
--- a/trusty/debian/cinder-scheduler.upstart.in
+++ /dev/null
@@ -1,26 +0,0 @@
-description "Cinder scheduler server"
-author "Chuck Short <zulcss@ubuntu.com>"
-
-start on runlevel [2345]
-stop on runlevel [!2345]
-
-chdir /var/run
-
-pre-start script
-    mkdir -p /var/run/cinder
-    chown cinder:cinder /var/run/cinder
-
-    mkdir -p /var/lock/cinder
-    chown cinder:root /var/lock/cinder
-end script
-
-script
-	[ -r /etc/default/openstack ] && . /etc/default/openstack
-	[ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB
-
-	[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
-	[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file /var/log/cinder/$UPSTART_JOB.log"
-
-	exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-scheduler -- \
-	                       --config-file=/etc/cinder/cinder.conf $DAEMON_ARGS
-end script
diff --git a/trusty/debian/cinder-volume.init b/trusty/debian/cinder-volume.init
deleted file mode 100644
index 23542cc23..000000000
--- a/trusty/debian/cinder-volume.init
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/bin/sh
-### BEGIN INIT INFO
-# Provides:          cinder-volume
-# Required-Start:    $network $local_fs $remote_fs $syslog
-# Required-Stop:     $remote_fs
-# Should-Start:      postgresql mysql keystone rabbitmq-server ntp
-# Should-Stop:       postgresql mysql keystone rabbitmq-server ntp
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Cinder Volume
-# Description:       Provides EBS like storage for your
-#                    virtual machine instances
-### END INIT INFO
-
-# Author: Julien Danjou <acid@debian.org>
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-DESC="OpenStack Cinder Volume"
-NAME=cinder-volume
-DAEMON=/usr/bin/cinder-volume
-DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf"
-PIDFILE=/var/run/cinder/$NAME.pid
-SCRIPTNAME=/etc/init.d/$NAME
-CINDER_USER=cinder
-LOCK_DIR=/var/lock/cinder/
-
-# Exit if the package is not installed
-[ -x $DAEMON ] || exit 0
-
-mkdir -p ${LOCK_DIR} /var/run/cinder
-chown ${CINDER_USER} ${LOCK_DIR} /var/run/cinder
-
-. /lib/lsb/init-functions
-
-[ -r /etc/default/openstack ] && . /etc/default/openstack
-[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-
-[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
-[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file=/var/log/cinder/cinder-volume.log"
-
-do_start() {
-	start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \
-		|| return 1
-	start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON -- \
-		$DAEMON_ARGS \
-		|| return 2
-}
-
-do_stop() {
-	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
-	RETVAL="$?"
-	rm -f $PIDFILE
-	return "$RETVAL"
-}
-
-case "$1" in
-start)
-	log_daemon_msg "Starting $DESC" "$NAME"
-	do_start
-	case "$?" in
-		0|1) log_end_msg 0 ;;
-		2) log_end_msg 1 ;;
-	esac
-;;
-stop)
-	log_daemon_msg "Stopping $DESC" "$NAME"
-	do_stop
-	case "$?" in
-		0|1) log_end_msg 0 ;;
-		2) log_end_msg 1 ;;
-	esac
-	;;
-status)
-	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
-;;
-restart|force-reload)
-	log_daemon_msg "Restarting $DESC" "$NAME"
-	do_stop
-	case "$?" in
-	0|1)
-		do_start
-		case "$?" in
-			0) log_end_msg 0 ;;
-			1) log_end_msg 1 ;; # Old process is still running
-			*) log_end_msg 1 ;; # Failed to start
-		esac
-	;;
-	*)
-		# Failed to stop
-		log_end_msg 1
-		;;
-	esac
-;;
-*)
-	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
-	exit 3
-;;
-esac
-
-exit 0
diff --git a/trusty/debian/cinder-volume.init.in b/trusty/debian/cinder-volume.init.in
new file mode 100644
index 000000000..15193efcc
--- /dev/null
+++ b/trusty/debian/cinder-volume.init.in
@@ -0,0 +1,21 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          cinder-volume
+# Required-Start:    $network $local_fs $remote_fs $syslog
+# Required-Stop:     $remote_fs
+# Should-Start:      postgresql mysql keystone rabbitmq-server ntp
+# Should-Stop:       postgresql mysql keystone rabbitmq-server ntp
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Cinder Volume
+# Description:       Provides EBS like storage for your
+#                    virtual machine instances
+### END INIT INFO
+
+# Author: Julien Danjou <acid@debian.org>
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="OpenStack Cinder Volume"
+PROJECT_NAME=cinder
+NAME=${PROJECT_NAME}-volume
diff --git a/trusty/debian/cinder-volume.service b/trusty/debian/cinder-volume.service
deleted file mode 100644
index 0fbc278c4..000000000
--- a/trusty/debian/cinder-volume.service
+++ /dev/null
@@ -1,17 +0,0 @@
-[Unit]
-Description=OpenStack Cinder Volume
-Documentation=http://docs.openstack.org/
-After=postgresql.service mysql.service keystone.service rabbitmq-server.service ntp.service network.service
-
-[Service]
-User=cinder
-Group=cinder
-ExecStart=/etc/init.d/cinder-volume systemd-start
-ExecStop=/etc/init.d/cinder-volume systemd-stop
-PIDFile=/var/run/cinder/cinder-volume.pid
-Restart=on-failure
-Type=forking
-
-[Install]
-WantedBy=multi-user.target
-
diff --git a/trusty/debian/cinder-volume.upstart.in b/trusty/debian/cinder-volume.upstart.in
deleted file mode 100644
index ebb14f0ce..000000000
--- a/trusty/debian/cinder-volume.upstart.in
+++ /dev/null
@@ -1,26 +0,0 @@
-description "Cinder volume server"
-author "Chuck Short <zulcss@ubuntu.com>"
-
-start on runlevel [2345]
-stop on runlevel [!2345]
-
-chdir /var/run
-
-pre-start script
-    mkdir -p /var/run/cinder
-    chown cinder:cinder /var/run/cinder
-
-    mkdir -p /var/lock/cinder
-    chown cinder:root /var/lock/cinder
-end script
-
-script
-	[ -r /etc/default/openstack ] && . /etc/default/openstack
-	[ -r /etc/default/$UPSTART_JOB ] && . /etc/default/$UPSTART_JOB
-
-	[ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
-	[ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS --log-file /var/log/cinder/$UPSTART_JOB.log"
-
-	exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-volume -- \
-	                       --config-file=/etc/cinder/cinder.conf $DAEMON_ARGS
-end script
diff --git a/trusty/debian/control b/trusty/debian/control
index a4522e0f7..f69fcdb31 100644
--- a/trusty/debian/control
+++ b/trusty/debian/control
@@ -6,7 +6,7 @@ Uploaders: Julien Danjou <acid@debian.org>,
            Thomas Goirand <zigo@debian.org>,
            Mehdi Abaakouk <sileht@sileht.net>
 Build-Depends: debhelper (>= 8.0.0),
-               openstack-pkg-tools (>= 12~),
+               openstack-pkg-tools (>= 13~),
                po-debconf,
                python-all (>= 2.6.6-3~),
                python-pbr (>= 0.6),
@@ -38,7 +38,7 @@ Build-Depends-Indep: python-anyjson (>= 0.3.3),
                      python-oslo.db (>= 0.4.0),
                      python-oslo.i18n (>= 1.0.0),
                      python-oslo.messaging (>= 1.4.1),
-                     python-oslo.rootwrap (>= 1.3.0.0~a1),
+                     python-oslo.rootwrap (>= 1.3.0.0),
                      python-oslosphinx (>= 2.2.0),
                      python-osprofiler,
                      python-paramiko (>= 1.13.0),
@@ -89,7 +89,7 @@ Depends: python-anyjson (>= 0.3.3),
          python-oslo.db (>= 0.4.0),
          python-oslo.i18n (>= 1.0.0),
          python-oslo.messaging (>= 1.4.1),
-         python-oslo.rootwrap (>= 1.3.0.0~a1),
+         python-oslo.rootwrap (>= 1.3.0.0),
          python-osprofiler,
          python-paramiko (>= 1.9.0),
          python-paste,
diff --git a/trusty/debian/rules b/trusty/debian/rules
index 3d7eca81d..553a3fb05 100755
--- a/trusty/debian/rules
+++ b/trusty/debian/rules
@@ -15,7 +15,7 @@ endif
 override_dh_clean:
 	dh_clean
 	rm -f debian/cinder-common.config debian/cinder-common.postinst debian/cinder-api.config debian/cinder-api.postinst debian/cinder-volume.postinst
-	rm -rf setuptools_git-*-py*.egg/
+	rm -rf debian/*.upstart debian/*.service
 
 override_dh_install:
 	dh_install --fail-missing -Xbin/cinder-all
-- 
2.45.2