Commit d4565098 authored by Ondřej Nový's avatar Ondřej Nový

Cleanup systemd and init scripts generator.

parent 70467545
......@@ -9,6 +9,7 @@ swift (2.22.0-1) UNRELEASED; urgency=medium
* Use pybuild to build package.
* Clean using d/clean file instead of override_dh_auto_clean target.
* Bump debhelper compat level to 12.
* Cleanup systemd and init scripts generator.
-- Ondřej Nový <onovy@debian.org> Mon, 05 Aug 2019 13:32:18 +0200
......
......@@ -11,6 +11,9 @@ SYSTEM_GROUP=${PROJECT_NAME}
# Find out what should go in After=
SHOULD_START=`cat ${INIT_TEMPLATE} | grep "# Should-Start:" | sed 's/# Should-Start://'`
INIT_FILE=`echo ${INIT_TEMPLATE} | sed 's/.init.in/.init/'`
SERVICE_FILE=`echo ${INIT_TEMPLATE} | sed 's/.init.in/.service/'`
if [ -n "${SHOULD_START}" ] ; then
AFTER="After="
for i in ${SHOULD_START} ; do
......@@ -22,10 +25,15 @@ if [ -n "$SYSTEMD_DOC" ] ; then
SYSTEMD_DOC="Documentation=$SYSTEMD_DOC"
fi
##############################
SERVICE_FILE=`echo ${INIT_TEMPLATE} | sed 's/.init.in/.service/'`
########
# init #
########
cp "$INIT_TEMPLATE" "$INIT_FILE"
cat debian/init-script-template >>"$INIT_FILE"
###########
# systemd #
###########
echo "[Unit]
Description=${DESC}
ConditionFileNotEmpty=/etc/${PROJECT_NAME}/${CONFIG}.conf
......
......@@ -16,32 +16,30 @@ override_dh_auto_build:
/usr/share/openstack-pkg-tools/pkgos_insert_include pkgos_func python3-swift.postinst
set -e ; set -x ; \
for i in $(sort $(wildcard debian/*.init.in)) ; do \
debian/gen-init $$i ; \
done
override_dh_auto_install:
dh_auto_install
rm debian/tmp/usr/bin/swift-init
override_dh_installinit:
set -e ; \
for i in $(sort $(wildcard debian/*.init.in)) ; do \
MYINIT=`echo $$i | sed -e s/.init.in//` ; \
INITPKG=`echo $$MYINIT | sed -e s:debian/:: | cut -d. -f1` ; \
INITNAME=`echo $$MYINIT | sed -e s:debian/:: | cut -d. -f2` ; \
echo "[installinit] Package: $$INITPKG Init: $$INITNAME" ; \
cp $$i $$MYINIT.init ; \
cat debian/init-script-template >>$$MYINIT.init ; \
dh_installinit --error-handler=true -p$$INITPKG --name=$$INITNAME ;\
set -e ; set -x ; \
for FILE in $(sort $(patsubst debian/%,%,$(wildcard debian/*.init))) ; do \
PKG=`echo $$FILE | cut -d. -f1` ; \
NAME=`echo $$FILE | cut -d. -f2` ; \
dh_installinit --error-handler=true -p$$PKG --name=$$NAME ;\
done
override_dh_installsystemd:
set -e ; \
for i in $(sort $(wildcard debian/*.init.in)) ; do \
MYINIT=`echo $$i | sed -e s/.init.in//` ; \
INITPKG=`echo $$MYINIT | sed -e s:debian/:: | cut -d. -f1` ; \
INITNAME=`echo $$MYINIT | sed -e s:debian/:: | cut -d. -f2` ; \
echo "[installsystemd] Package: $$INITPKG Init: $$INITNAME" ; \
debian/gen-systemd-unit $$i ; \
dh_installsystemd -p$$INITPKG --name=$$INITNAME ;\
set -e ; set -x ; \
for FILE in $(sort $(patsubst debian/%,%,$(wildcard debian/*.service))) ; do \
PKG=`echo $$FILE | cut -d. -f1` ; \
NAME=`echo $$FILE | cut -d. -f2` ; \
dh_installsystemd -p$$PKG --name=$$NAME ;\
done
override_dh_systemd_enable:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment