From 094faf44cbadac1b5f3a8e2f520ee39a62cddfd6 Mon Sep 17 00:00:00 2001 From: Terje Rosten Date: Jan 13 2020 19:39:27 +0000 Subject: Protect more instances of ". /etc/config/selinux" --- diff --git a/selinux-policy.spec b/selinux-policy.spec index 4b399e8..c81f7b2 100644 --- a/selinux-policy.spec +++ b/selinux-policy.spec @@ -268,7 +268,9 @@ rm -f %{buildroot}%{_sharedstatedir}/selinux/%1/active/*.linked \ %nil %define relabel() \ -. %{_sysconfdir}/selinux/config; \ +if [ -e %{_sysconfdir}/selinux/config ]; then \ + . %{_sysconfdir}/selinux/config; \ +fi; \ FILE_CONTEXT=%{_sysconfdir}/selinux/%1/contexts/files/file_contexts; \ /usr/sbin/selinuxenabled; \ if [ $? = 0 -a "${SELINUXTYPE}" = %1 -a -f ${FILE_CONTEXT}.pre ]; then \ @@ -301,7 +303,9 @@ if [ $1 -ne 1 ] && [ -s /etc/selinux/config ]; then \ fi; %define postInstall() \ -. %{_sysconfdir}/selinux/config; \ +if [ -e %{_sysconfdir}/selinux/config ]; then \ + . %{_sysconfdir}/selinux/config; \ +fi; \ if [ -e /etc/selinux/%2/.rebuild ]; then \ rm /etc/selinux/%2/.rebuild; \ /usr/sbin/semodule -B -n -s %2; \ @@ -342,7 +346,9 @@ done; # * use "targeted" if it's being installed and BACKUP_SELINUXTYPE cannot be used # * check whether SELINUXTYPE in the config is usable and change it to newly installed policy if it isn't %define checkConfigConsistency() \ -. %{_sysconfdir}/selinux/config; \ +if [ -e %{_sysconfdir}/selinux/config ]; then \ + . %{_sysconfdir}/selinux/config; \ +fi; \ if [ -f %{_sysconfdir}/selinux/.config_backup ]; then \ . %{_sysconfdir}/selinux/.config_backup; \ else \