[Kimchi-devel] [PATCH v2] Configure deb package to use systemd service if needed
Jose Ricardo Ziviani
joserz at linux.vnet.ibm.com
Mon Oct 5 13:12:22 UTC 2015
Signed-off-by: Jose Ricardo Ziviani <joserz at linux.vnet.ibm.com>
---
Makefile.am | 12 +++++++++---
contrib/DEBIAN/control.in | 3 ++-
contrib/DEBIAN/postinst | 26 ++++++++++++++++++++++++++
3 files changed, 37 insertions(+), 4 deletions(-)
create mode 100755 contrib/DEBIAN/postinst
diff --git a/Makefile.am b/Makefile.am
index 0eabd3d..70c48ef 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,10 +70,16 @@ all-local:
install-deb: install
cp -R $(top_srcdir)/contrib/DEBIAN $(DESTDIR)/
- $(MKDIR_P) $(DESTDIR)/etc/init
+ @if test -d "$(systemdsystemunitdir)" ; then \
+ $(MKDIR_P) $(DESTDIR)/$(systemdsystemunitdir); \
+ cp -R contrib/wokd.service.fedora \
+ $(DESTDIR)/$(systemdsystemunitdir)/wokd.service; \
+ else \
+ $(MKDIR_P) $(DESTDIR)/etc/init; \
+ cp -R $(top_srcdir)/contrib/wokd-upstart.conf.debian \
+ $(DESTDIR)/etc/init/wokd.conf; \
+ fi
$(MKDIR_P) $(DESTDIR)/usr/lib/firewalld/services
- cp -R $(top_srcdir)/contrib/wokd-upstart.conf.debian \
- $(DESTDIR)/etc/init/wokd.conf
cp -R $(top_srcdir)/src/firewalld.xml \
$(DESTDIR)/usr/lib/firewalld/services/wokd.xml
diff --git a/contrib/DEBIAN/control.in b/contrib/DEBIAN/control.in
index b21133c..50dc837 100644
--- a/contrib/DEBIAN/control.in
+++ b/contrib/DEBIAN/control.in
@@ -17,6 +17,7 @@ Depends: python-cherrypy3 (>= 3.2.0),
texlive-fonts-extra
Build-Depends: libxslt,
openssl,
- python-lxml
+ python-lxml,
+ pkg-config
Maintainer: Aline Manera <alinefm at br.ibm.com>
Description: Wok - Webserver Originated from Kimchi
diff --git a/contrib/DEBIAN/postinst b/contrib/DEBIAN/postinst
new file mode 100755
index 0000000..98f9c4e
--- /dev/null
+++ b/contrib/DEBIAN/postinst
@@ -0,0 +1,26 @@
+#!/bin/sh -e
+#
+# Project Wok
+#
+# Copyright IBM, Corp. 2015
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+systemd_exists=$(type /bin/systemctl > /dev/null 2>&1; echo $?)
+if test $systemd_exists = "0"; then
+ /bin/systemctl enable wokd > /dev/null 2>&1
+ /bin/systemctl daemon-reload > /dev/null 2>&1
+ /bin/systemctl start wokd > /dev/null 2>&1
+fi
--
1.9.1
More information about the Kimchi-devel
mailing list