build(selinux): correct SPEC file to install anvil subnode policy

main
Tsu-ba-me 9 months ago
parent 44615bb22f
commit 3e9783d55b
  1. 21
      anvil.spec.in

@ -5,8 +5,11 @@
%define debug_package %{nil} %define debug_package %{nil}
%define anviluser admin %define anviluser admin
%define anvilgroup admin %define anvilgroup admin
%define selinuxtype targeted
%define suiapi striker-ui-api %define suiapi striker-ui-api
%define selinuxdir %{_datadir}/selinux/packages/%{selinuxtype}
Name: anvil Name: anvil
Version: @version@ Version: @version@
Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
@ -24,6 +27,8 @@ BuildRequires: systemd autoconf automake make
BuildRequires: fence-agents-common BuildRequires: fence-agents-common
# OCFROOT # OCFROOT
BuildRequires: resource-agents BuildRequires: resource-agents
# required to build SELinux policy
BuildRequires: selinux-policy-devel
%description %description
This package generates the anvil-core, anvil-striker, anvil-node and anvil-dr This package generates the anvil-core, anvil-striker, anvil-node and anvil-dr
@ -104,6 +109,7 @@ Requires: postgresql-contrib
Requires: postgresql-plperl Requires: postgresql-plperl
Requires: rsync Requires: rsync
Requires: screen Requires: screen
Requires: selinux-policy >= %{_selinux_policy_version}
Requires: smartmontools Requires: smartmontools
Requires: strace Requires: strace
Requires: syslinux Requires: syslinux
@ -242,9 +248,14 @@ getent passwd %{anviluser} >/dev/null || useradd --create-home \
%post core %post core
# TODO: Remove this!! This is only for use during development, all SELinux # TODO: Remove this!! This is only for use during development, all SELinux
# issues must be resolved before final release! # issues must be resolved before final release!
echo "WARNING: Setting SELinux to 'permissive' during development." # echo "WARNING: Setting SELinux to 'permissive' during development."
sed -i.anvil 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config # sed -i.anvil 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
setenforce 0 # setenforce 0
#
if [ $1 == 1 ]; then
%selinux_modules_install -s %{selinuxtype} -p 200 ${selinuxdir}/anvil-subnode.pp
fi
# Enable and start the anvil-daemon # Enable and start the anvil-daemon
### TODO: check it if was disabled (if it existed before) and, if so, leave it disabled. ### TODO: check it if was disabled (if it existed before) and, if so, leave it disabled.
systemctl enable --now chronyd.service systemctl enable --now chronyd.service
@ -354,6 +365,9 @@ touch /etc/anvil/type.dr
# echo "NOTE: Re-enabling SELinux." # echo "NOTE: Re-enabling SELinux."
# sed -i.anvil 's/SELINUX=permissive/SELINUX=enforcing/' /etc/selinux/config # sed -i.anvil 's/SELINUX=permissive/SELINUX=enforcing/' /etc/selinux/config
# setenforce 1 # setenforce 1
if [ $1 == 0 ]; then
%selinux_modules_uninstall -s %{selinuxtype} -p 200 ${selinuxdir}/anvil-subnode.pp
fi
%preun striker %preun striker
if [ $1 == 0 ]; then # 0=Uninstall, 1=First install, >1=Upgrade (version count) if [ $1 == 0 ]; then # 0=Uninstall, 1=First install, >1=Upgrade (version count)
@ -410,6 +424,7 @@ fi
%{_sysconfdir}/anvil/anvil.version %{_sysconfdir}/anvil/anvil.version
%{_datadir}/perl5/* %{_datadir}/perl5/*
%{_mandir}/* %{_mandir}/*
%{selinuxdir}/*.pp
%files striker %files striker
%{_localstatedir}/www/*/* %{_localstatedir}/www/*/*

Loading…
Cancel
Save