commit 51ba8ebe1a74ce2fab6c4b469c942fa8962b5ff0 Author: Toshaan Bharvani Date: Tue May 28 16:16:17 2024 +0200 initial package creation Signed-off-by: Toshaan Bharvani diff --git a/SOURCES/icingadb.service b/SOURCES/icingadb.service new file mode 100644 index 0000000..0ae5845 --- /dev/null +++ b/SOURCES/icingadb.service @@ -0,0 +1,12 @@ +[Unit] +Description=Icinga DB +After=syslog.target network-online.target icingadb-redis.service mariadb.service + +[Service] +Type=notify +ExecStart=/usr/sbin/icingadb --config /etc/icingadb/config.yml +User=icingadb +Group=icingadb + +[Install] +WantedBy=multi-user.target diff --git a/SPECS/icingadb.spec b/SPECS/icingadb.spec new file mode 100644 index 0000000..91daf02 --- /dev/null +++ b/SPECS/icingadb.spec @@ -0,0 +1,79 @@ +%global provider github +%global provider_tld com +%global project Icinga +%global repo icingadb +%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} +%global import_path %{provider_prefix} +%define debug_package %nil +%define configdir %{_sysconfdir}/%{name} +%define service %{name}.service + +Name: icingadb +Version: 1.2.0 +Release: 1%{?dist} +Summary: Icinga DB +Group: System Environment/Daemons +License: GPLv2+ +URL: https://%{provider_prefix} +#Source0: https://%{import_path}/archive/v%{version}.tar.gz +Source1: icingadb.service +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} +BuildRequires: gcc +BuildRequires: git +BuildRequires: systemd +Requires(pre): shadow-utils + + +%description +Icinga DB + + +%prep +%setup -q -T -c %{name}-%{version} +git clone https://%{provider_prefix} . + +%build +git checkout v%{version} +sed 's/go 1.22$/go 1.22.0/' -i go.mod +go build -v -ldflags "-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -buildid "%{version}"" -buildvcs=false -trimpath ./cmd/icingadb + + +%install +install -d -m 0755 %{buildroot}%{_sbindir} +install -d -m 0755 %{buildroot}%{configdir} +install -d -m 0755 %{buildroot}%{_unitdir} +install -m 0755 icingadb %{buildroot}%{_sbindir}/ +install -m 0644 config.example.yml %{buildroot}%{configdir}/config.yml +install -m 0644 %{S:1} %{buildroot}%{_unitdir}/ +install -d -m 0755 %{buildroot}%{_datadir}/%{name} +(umask 0022 && cp -rv schema %{buildroot}%{_datadir}/%{name}/) + + +%pre +getent group icingadb >/dev/null || groupadd -r icingadb +getent passwd icingadb >/dev/null || useradd -r -g icingadb -d /etc/icingadb -s /sbin/nologin -c 'Icinga DB' icingadb +%post +%systemd_post %{service} +%preun +%systemd_preun %{service} +%postun +%systemd_postun %{service} + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root) +%doc LICENSE AUTHORS README.md CHANGELOG.md +%{_sbindir}/icingadb +%{_unitdir}/%{service} +%dir %{_datadir}/%{name} +%{_datadir}/%{name}/schema +%defattr(0644,icingadb,icingadb,0755) +%dir %{configdir} +%config(noreplace) %{configdir}/config.yml + + +%changelog