You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.7 KiB

%global module_name director
%global icingaweb_min_version 2.10.3
%global basedir %{_datadir}/icingaweb2/modules/%{module_name}
Name: icingaweb2-module-%{module_name}
Version: 1.11.1
Release: 1%{?dist}
Summary: Configuration deployment tool in the Icinga ecosystem
Group: Applications/System
License: GPLv2+
URL: https://icinga.com
Source0: https://github.com/Icinga/icingaweb2-module-%{module_name}/archive/v%{version}.tar.gz
BuildArch: noarch
Requires: icingaweb2 >= %{icingaweb_min_version}
Requires: php-Icinga >= %{icingaweb_min_version}
Requires: icingaweb2-module-%{module_name}-daemon = %{version}-%{release}
%description
Icinga Director is the configuration deployment tool in the Icinga ecosystem,
designed for automating configuration deployments,
but also for making changes directly in the webinterface.
%package daemon
Requires(pre): shadow-utils
Requires: icingaweb2-module-%{module_name} = %{version}-%{release}
Requires: icingacli >= %{icingaweb_min_version}
Requires: php-process
Summary: Icinga Director daemon files
%description daemon
Daemon files for Icinga Director.
%prep
%autosetup
%build
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{basedir}
cp -r * %{buildroot}%{basedir}
install -Dpm 0644 contrib/systemd/icinga-director.service %{buildroot}%{_unitdir}/icinga-director.service
install -dm 0750 %{buildroot}/var/lib/icingadirector
%preun
if [ $1 == 0 ]; then
rm -f /etc/icingaweb2/enabledModules/director
fi
%post
if [ $1 == 1 ]; then
if [ ! -d /etc/icingaweb2/enabledModules ]; then
install -dm 2770 -g icingaweb2 /etc/icingaweb2/enabledModules
fi
ln -sf /usr/share/icingaweb2/modules/director /etc/icingaweb2/enabledModules/director
fi
%pre daemon
getent passwd icingadirector >/dev/null || useradd -r -G icingaweb2 -d /var/lib/icingadirector -s /sbin/nologin icingadirector
%post daemon
if [ $1 -eq 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
/usr/lib/systemd/systemd-update-helper install-system-units icinga-director.service || :
fi
%preun daemon
if [ $1 -eq 0 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
/usr/lib/systemd/systemd-update-helper remove-system-units icinga-director.service || :
fi
%postun daemon
if [ $1 -ge 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
/usr/lib/systemd/systemd-update-helper mark-restart-system-units icinga-director.service || :
fi
test "$1" != 0 || userdel -rf icingadirector &>/dev/null || :
%files
%doc README.md
%docdir %{_datadir}/icingaweb2/modules/%{module_name}/doc
%license LICENSE
%{_datadir}/icingaweb2/modules/%{module_name}/
%files daemon
/usr/lib/systemd/system/icinga-director.service
%attr(-,icingadirector,icingaweb2) /var/lib/icingadirector
%changelog