Skip to content

Commit

Permalink
Add systemd unit file for kojivmd
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Gilmore <[email protected]>
  • Loading branch information
keszybz authored and ausil committed Jun 7, 2015
1 parent 10a75fc commit 7c43549
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 6 deletions.
24 changes: 24 additions & 0 deletions koji.spec
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,16 @@ Summary: Koji virtual machine management daemon
Group: Applications/System
License: LGPLv2
Requires: %{name} = %{version}-%{release}
%if %{use_systemd}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%else
Requires(post): /sbin/chkconfig
Requires(post): /sbin/service
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
%endif
Requires: libvirt-python
Requires: libxml2-python
Requires: /usr/bin/virt-clone
Expand Down Expand Up @@ -250,11 +256,28 @@ fi
%{_sbindir}/kojivmd
#dir %{_datadir}/kojivmd
%{_datadir}/kojivmd/kojikamid
%if %{use_systemd}
%{_unitdir}/kojivmd.service
%else
%{_initrddir}/kojivmd
%config(noreplace) %{_sysconfdir}/sysconfig/kojivmd
%endif
%dir %{_sysconfdir}/kojivmd
%config(noreplace) %{_sysconfdir}/kojivmd/kojivmd.conf

%if %{use_systemd}

%post vm
%systemd_post kojivmd.service

%preun vm
%systemd_preun kojivmd.service

%postun vm
%systemd_postun kojivmd.service

%else

%post vm
/sbin/chkconfig --add kojivmd

Expand All @@ -263,6 +286,7 @@ if [ $1 = 0 ]; then
/sbin/service kojivmd stop &> /dev/null
/sbin/chkconfig --del kojivmd
fi
%endif

%post utils
/sbin/chkconfig --add kojira
Expand Down
18 changes: 12 additions & 6 deletions vm/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

BINFILES = kojivmd
SHAREFILES = kojikamid
SYSTEMDSYSTEMUNITDIR = $(shell pkg-config systemd --variable=systemdsystemunitdir)
TYPE = systemd

_default:
@echo "nothing to make. try make install"
Expand All @@ -11,7 +12,7 @@ clean:
kojikamid: kojikamid.py
bash fix_kojikamid.sh >kojikamid

install: kojikamid
_install: kojikamid
@if [ "$(DESTDIR)" = "" ]; then \
echo " "; \
echo "ERROR: A destdir is required"; \
Expand All @@ -24,13 +25,18 @@ install: kojikamid
mkdir -p $(DESTDIR)/usr/share/kojivmd
install -p -m 644 $(SHAREFILES) $(DESTDIR)/usr/share/kojivmd

mkdir -p $(DESTDIR)/etc/kojivmd
install -p -m 644 kojivmd.conf $(DESTDIR)/etc/kojivmd/kojivmd.conf

install-systemd: _install
mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
install -p -m 644 kojivmd.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)

install-sysv: _install
mkdir -p $(DESTDIR)/etc/rc.d/init.d
install -p -m 755 kojivmd.init $(DESTDIR)/etc/rc.d/init.d/kojivmd

mkdir -p $(DESTDIR)/etc/sysconfig
install -p -m 644 kojivmd.sysconfig $(DESTDIR)/etc/sysconfig/kojivmd

mkdir -p $(DESTDIR)/etc/kojivmd
install -p -m 644 kojivmd.conf $(DESTDIR)/etc/kojivmd/kojivmd.conf


install: install-$(TYPE)
14 changes: 14 additions & 0 deletions vm/kojivmd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Koji vm build server
Documentation=https://fedoraproject.org/wiki/Koji/ServerHowTo

After=network.target

[Service]
ExecStart=/usr/sbin/kojivmd \
--fg \
--force-lock \
--verbose

[Install]
WantedBy=multi-user.target

0 comments on commit 7c43549

Please sign in to comment.