From e5a904f82bb72cd92b6144cce1c5afe92b5b8562 Mon Sep 17 00:00:00 2001 From: Toshaan Bharvani Date: Tue, 28 May 2024 17:19:54 +0200 Subject: [PATCH] initial package creation Signed-off-by: Toshaan Bharvani --- SOURCES/.gitkeeper | 0 SPECS/icinga-l10n.spec | 98 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 SOURCES/.gitkeeper create mode 100644 SPECS/icinga-l10n.spec diff --git a/SOURCES/.gitkeeper b/SOURCES/.gitkeeper new file mode 100644 index 0000000..e69de29 diff --git a/SPECS/icinga-l10n.spec b/SPECS/icinga-l10n.spec new file mode 100644 index 0000000..b80afca --- /dev/null +++ b/SPECS/icinga-l10n.spec @@ -0,0 +1,98 @@ +%define basedir %{_datadir}/icinga-L10n + +Name: icinga-l10n +Version: 1.3.0 +Release: 1%{?dist} +Summary: Icinga L10n +License: GPLv2+ +URL: https://icinga.com +Source0: https://github.com/Icinga/L10n/archive/v%{version}.tar.gz +BuildArch: noarch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} + + +%description +L10n (short for Localization) provides all translations available for Icinga. + + +%package selinux +Summary: Icinga L10n SELinux policy +Source100: icinga-l10n.te +Source101: icinga-l10n.fc +BuildRequires: checkpolicy +BuildRequires: selinux-policy-devel +Requires: icinga-l10n = 1.3.0 +Requires: selinux-policy >= %{_selinux_policy_version} +Requires(post): policycoreutils +Requires(postun): policycoreutils +%description selinux +SELinux policy for Icinga L10n. + + +%prep +%setup -q -n L10n-%{version} +mkdir SELinux +cp %{SOURCE100} SELinux/ +cp %{SOURCE101} SELinux/ + + +%build +cd SELinux +for selinuxvariant in mls targeted; do + make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile + mv icinga-l10n.pp icinga-l10n.pp.${selinuxvariant} + make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean +done + + +%install +mkdir -p %{buildroot}/%{basedir} +cp *.md %{buildroot}/%{basedir} +cp LICENSE %{buildroot}/%{basedir} +cp -prv locale %{buildroot}/%{basedir} +find %{buildroot}/%{basedir}/locale -name *.po -delete +for selinuxvariant in mls targeted; do + install -Dpm 0644 SELinux/icinga-l10n.pp.${selinuxvariant} %{buildroot}/%{_datadir}/selinux/${selinuxvariant}/icinga-l10n.pp +done + + + +%clean +rm -rf %{buildroot} + + +%post selinux +for selinuxvariant in mls targeted; do + /usr/sbin/semodule -s ${selinuxvariant} -i /usr/share/selinux/${selinuxvariant}/icinga-l10n.pp &> /dev/null || true +done +/usr/sbin/fixfiles -R icinga-l10n restore || true +for dir in /usr/share/icinga-L10n; do + /usr/sbin/restorecon -R ${dir} || true +done + +%postun selinux +if [ $1 -eq 0 ]; then + for selinuxvariant in mls targeted; do + /usr/sbin/semodule -s ${selinuxvariant} -r icinga-l10n &> /dev/null || true + done + /usr/sbin/fixfiles -R icinga-l10n restore || true + for dir in /usr/share/icinga-L10n; do + if [ -d ${dir} ]; then + /usr/sbin/restorecon -R ${dir} &> /dev/null || true + fi + done +fi + + +%files +%defattr(-,root,root) +%{basedir} +#%doc README.md CONTRIBUTING.md +%license LICENSE + + +%files selinux +%{_datadir}/selinux/*/icinga-l10n.pp + + +%changelog