Add systemd unit file for kojid
Signed-off-by: Dennis Gilmore <dennis@ausil.us>
This commit is contained in:
parent
3260dbebdb
commit
10a75fc22f
4 changed files with 66 additions and 9 deletions
3
Makefile
3
Makefile
|
|
@ -105,6 +105,7 @@ force-tag::
|
||||||
# @$(MAKE) tag TAG_OPTS="-F $(TAG_OPTS)"
|
# @$(MAKE) tag TAG_OPTS="-F $(TAG_OPTS)"
|
||||||
|
|
||||||
DESTDIR ?= /
|
DESTDIR ?= /
|
||||||
|
TYPE = systemd
|
||||||
install:
|
install:
|
||||||
@if [ "$(DESTDIR)" = "" ]; then \
|
@if [ "$(DESTDIR)" = "" ]; then \
|
||||||
echo " "; \
|
echo " "; \
|
||||||
|
|
@ -115,4 +116,4 @@ install:
|
||||||
mkdir -p $(DESTDIR)
|
mkdir -p $(DESTDIR)
|
||||||
|
|
||||||
for d in $(SUBDIRS); do make DESTDIR=`cd $(DESTDIR); pwd` \
|
for d in $(SUBDIRS); do make DESTDIR=`cd $(DESTDIR); pwd` \
|
||||||
-C $$d install; [ $$? = 0 ] || exit 1; done
|
-C $$d install TYPE=$(TYPE); [ $$? = 0 ] || exit 1; done
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
BINFILES = kojid
|
BINFILES = kojid
|
||||||
LIBEXECFILES = mergerepos
|
LIBEXECFILES = mergerepos
|
||||||
|
SYSTEMDSYSTEMUNITDIR = $(shell pkg-config systemd --variable=systemdsystemunitdir)
|
||||||
|
TYPE = systemd
|
||||||
|
|
||||||
_default:
|
_default:
|
||||||
@echo "nothing to make. try make install"
|
@echo "nothing to make. try make install"
|
||||||
|
|
@ -9,7 +10,7 @@ clean:
|
||||||
rm -f *.o *.so *.pyc *~
|
rm -f *.o *.so *.pyc *~
|
||||||
|
|
||||||
|
|
||||||
install:
|
_install:
|
||||||
@if [ "$(DESTDIR)" = "" ]; then \
|
@if [ "$(DESTDIR)" = "" ]; then \
|
||||||
echo " "; \
|
echo " "; \
|
||||||
echo "ERROR: A destdir is required"; \
|
echo "ERROR: A destdir is required"; \
|
||||||
|
|
@ -23,13 +24,19 @@ install:
|
||||||
install -p -m 755 $(LIBEXECFILES) $(DESTDIR)/usr/libexec/kojid
|
install -p -m 755 $(LIBEXECFILES) $(DESTDIR)/usr/libexec/kojid
|
||||||
|
|
||||||
mkdir -p $(DESTDIR)/etc/mock/koji
|
mkdir -p $(DESTDIR)/etc/mock/koji
|
||||||
|
|
||||||
|
mkdir -p $(DESTDIR)/etc/kojid
|
||||||
|
install -p -m 644 kojid.conf $(DESTDIR)/etc/kojid/kojid.conf
|
||||||
|
|
||||||
|
install-systemd: _install
|
||||||
|
mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
|
||||||
|
install -p -m 644 kojid.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
|
||||||
|
|
||||||
|
install-sysv: _install
|
||||||
mkdir -p $(DESTDIR)/etc/rc.d/init.d
|
mkdir -p $(DESTDIR)/etc/rc.d/init.d
|
||||||
install -p -m 755 kojid.init $(DESTDIR)/etc/rc.d/init.d/kojid
|
install -p -m 755 kojid.init $(DESTDIR)/etc/rc.d/init.d/kojid
|
||||||
|
|
||||||
mkdir -p $(DESTDIR)/etc/sysconfig
|
mkdir -p $(DESTDIR)/etc/sysconfig
|
||||||
install -p -m 644 kojid.sysconfig $(DESTDIR)/etc/sysconfig/kojid
|
install -p -m 644 kojid.sysconfig $(DESTDIR)/etc/sysconfig/kojid
|
||||||
|
|
||||||
mkdir -p $(DESTDIR)/etc/kojid
|
install: install-$(TYPE)
|
||||||
install -p -m 644 kojid.conf $(DESTDIR)/etc/kojid/kojid.conf
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
14
builder/kojid.service
Normal file
14
builder/kojid.service
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Koji build server
|
||||||
|
Documentation=https://fedoraproject.org/wiki/Koji/ServerHowTo
|
||||||
|
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/sbin/kojid \
|
||||||
|
--fg \
|
||||||
|
--force-lock \
|
||||||
|
--verbose
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
39
koji.spec
39
koji.spec
|
|
@ -1,5 +1,12 @@
|
||||||
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
||||||
|
|
||||||
|
%if 0%{?fedora} >= 21 || 0%{?redhat} >= 7
|
||||||
|
%global use_systemd 1
|
||||||
|
%else
|
||||||
|
%global use_systemd 0
|
||||||
|
%global install_opt TYPE=sysv
|
||||||
|
%endif
|
||||||
|
|
||||||
%define baserelease 1
|
%define baserelease 1
|
||||||
#build with --define 'testbuild 1' to have a timestamp appended to release
|
#build with --define 'testbuild 1' to have a timestamp appended to release
|
||||||
%if "x%{?testbuild}" == "x1"
|
%if "x%{?testbuild}" == "x1"
|
||||||
|
|
@ -23,6 +30,10 @@ Requires: rpm-python
|
||||||
Requires: pyOpenSSL
|
Requires: pyOpenSSL
|
||||||
Requires: python-urlgrabber
|
Requires: python-urlgrabber
|
||||||
BuildRequires: python
|
BuildRequires: python
|
||||||
|
%if %{use_systemd}
|
||||||
|
BuildRequires: systemd
|
||||||
|
BuildRequires: pkgconfig
|
||||||
|
%endif
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Koji is a system for building and tracking RPMS. The base package
|
Koji is a system for building and tracking RPMS. The base package
|
||||||
|
|
@ -63,11 +74,17 @@ License: LGPLv2 and GPLv2+
|
||||||
#mergerepos (from createrepo) is GPLv2+
|
#mergerepos (from createrepo) is GPLv2+
|
||||||
Requires: %{name} = %{version}-%{release}
|
Requires: %{name} = %{version}-%{release}
|
||||||
Requires: mock >= 0.9.14
|
Requires: mock >= 0.9.14
|
||||||
|
Requires(pre): /usr/sbin/useradd
|
||||||
|
%if %{use_systemd}
|
||||||
|
Requires(post): systemd
|
||||||
|
Requires(preun): systemd
|
||||||
|
Requires(postun): systemd
|
||||||
|
%else
|
||||||
Requires(post): /sbin/chkconfig
|
Requires(post): /sbin/chkconfig
|
||||||
Requires(post): /sbin/service
|
Requires(post): /sbin/service
|
||||||
Requires(preun): /sbin/chkconfig
|
Requires(preun): /sbin/chkconfig
|
||||||
Requires(preun): /sbin/service
|
Requires(preun): /sbin/service
|
||||||
Requires(pre): /usr/sbin/useradd
|
%endif
|
||||||
Requires: /usr/bin/cvs
|
Requires: /usr/bin/cvs
|
||||||
Requires: /usr/bin/svn
|
Requires: /usr/bin/svn
|
||||||
Requires: /usr/bin/git
|
Requires: /usr/bin/git
|
||||||
|
|
@ -135,7 +152,7 @@ koji-web is a web UI to the Koji system.
|
||||||
|
|
||||||
%install
|
%install
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
make DESTDIR=$RPM_BUILD_ROOT install
|
make DESTDIR=$RPM_BUILD_ROOT %{?install_opt} install
|
||||||
|
|
||||||
%clean
|
%clean
|
||||||
rm -rf $RPM_BUILD_ROOT
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
@ -192,8 +209,12 @@ rm -rf $RPM_BUILD_ROOT
|
||||||
%{_sbindir}/kojid
|
%{_sbindir}/kojid
|
||||||
%dir %{_libexecdir}/kojid
|
%dir %{_libexecdir}/kojid
|
||||||
%{_libexecdir}/kojid/mergerepos
|
%{_libexecdir}/kojid/mergerepos
|
||||||
|
%if %{use_systemd}
|
||||||
|
%{_unitdir}/kojid.service
|
||||||
|
%else
|
||||||
%{_initrddir}/kojid
|
%{_initrddir}/kojid
|
||||||
%config(noreplace) %{_sysconfdir}/sysconfig/kojid
|
%config(noreplace) %{_sysconfdir}/sysconfig/kojid
|
||||||
|
%endif
|
||||||
%dir %{_sysconfdir}/kojid
|
%dir %{_sysconfdir}/kojid
|
||||||
%config(noreplace) %{_sysconfdir}/kojid/kojid.conf
|
%config(noreplace) %{_sysconfdir}/kojid/kojid.conf
|
||||||
%attr(-,kojibuilder,kojibuilder) %{_sysconfdir}/mock/koji
|
%attr(-,kojibuilder,kojibuilder) %{_sysconfdir}/mock/koji
|
||||||
|
|
@ -201,6 +222,19 @@ rm -rf $RPM_BUILD_ROOT
|
||||||
%pre builder
|
%pre builder
|
||||||
/usr/sbin/useradd -r -s /bin/bash -G mock -d /builddir -M kojibuilder 2>/dev/null ||:
|
/usr/sbin/useradd -r -s /bin/bash -G mock -d /builddir -M kojibuilder 2>/dev/null ||:
|
||||||
|
|
||||||
|
%if %{use_systemd}
|
||||||
|
|
||||||
|
%post builder
|
||||||
|
%systemd_post kojid.service
|
||||||
|
|
||||||
|
%preun builder
|
||||||
|
%systemd_preun kojid.service
|
||||||
|
|
||||||
|
%postun builder
|
||||||
|
%systemd_postun kojid.service
|
||||||
|
|
||||||
|
%else
|
||||||
|
|
||||||
%post builder
|
%post builder
|
||||||
/sbin/chkconfig --add kojid
|
/sbin/chkconfig --add kojid
|
||||||
|
|
||||||
|
|
@ -209,6 +243,7 @@ if [ $1 = 0 ]; then
|
||||||
/sbin/service kojid stop &> /dev/null
|
/sbin/service kojid stop &> /dev/null
|
||||||
/sbin/chkconfig --del kojid
|
/sbin/chkconfig --del kojid
|
||||||
fi
|
fi
|
||||||
|
%endif
|
||||||
|
|
||||||
%files vm
|
%files vm
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue