Fix sed regexes

This commit is contained in:
Daniel Demus 2024-07-15 01:41:11 +02:00
parent 1668f8e992
commit d953c282f2

View File

@ -40,17 +40,19 @@ mv crs-setup.conf.example %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/crs-set
%post %post
# activate base_rules # activate base_rules
for f in `ls %{buildroot}%{_datarootdir}/mod_modsecurity_crs/rules/` ; do for f in `ls %{_datarootdir}/mod_modsecurity_crs/rules/` ; do
ln -s %{_datarootdir}/mod_modsecurity_crs/rules/$f %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/activated_rules/$f; ln -s %{_datarootdir}/mod_modsecurity_crs/rules/$f %{_sysconfdir}/httpd/modsecurity.d/activated_rules/$f;
done done
sed '/Include(Optional)? modsecurity.d\/\*\.conf/a\tInclude$1 modsecurity.d/plugins/*-config.conf\n\tInclude$1 modsecurity.d/plugins/*-before.conf' %{_httpd_confdir}/mod_security.conf sed -i '/IncludeOptional modsecurity\.d\/\*\.conf/ a\ IncludeOptional modsecurity.d\/plugins\/*-config.conf\n IncludeOptional modsecurity.d\/plugins\/*-before.conf' %{_httpd_confdir}/mod_security.conf
sed '/Include(Optional)? modsecurity.d\/local_rules\/\*\.conf/a\tInclude$1 modsecurity.d/plugins/*-after.conf' %{_httpd_confdir}/mod_security.conf sed -i '/Include modsecurity\.d\/\*\.conf/a\ Include modsecurity.d/plugins/*-config.conf\n Include modsecurity.d/plugins/*-before.conf' %{_httpd_confdir}/mod_security.conf
sed -i '/IncludeOptional modsecurity\.d\/local_rules\/\*\.conf/a\ IncludeOptional modsecurity.d\/plugins\/*-after.conf' %{_httpd_confdir}/mod_security.conf
sed -i '/Include modsecurity\.d\/local_rules\/\*\.conf/a\ Include modsecurity.d\/plugins\/*-after.conf' %{_httpd_confdir}/mod_security.conf
%postun %postun
sed '/Include(Optional)? modsecurity.d\/plugins/d' %{_httpd_confdir}/mod_security.conf sed -iE '/Include(Optional)? modsecurity.d\/plugins/d' %{_httpd_confdir}/mod_security.conf
for f in `ls %{buildroot}%{_datarootdir}/mod_modsecurity_crs/rules/` ; do for f in `ls %{_datarootdir}/mod_modsecurity_crs/rules/` ; do
%{__rm} %{buildroot}%{_sysconfdir}/httpd/modsecurity.d/activated_rules/$f; %{__rm} %{_sysconfdir}/httpd/modsecurity.d/activated_rules/$f;
done done
%files %files