Added named.conf API transformation to post action
This commit is contained in:
parent
39d17ae94e
commit
cf42c42e50
@ -2,7 +2,7 @@
|
||||
|
||||
Name: bind-dyndb-ldap
|
||||
Version: 11.0
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: LDAP back-end plug-in for BIND
|
||||
|
||||
Group: System Environment/Libraries
|
||||
@ -45,16 +45,55 @@ rm %{buildroot}%{_libdir}/bind/ldap.la
|
||||
rm -r %{buildroot}%{_datadir}/doc/%{name}
|
||||
|
||||
|
||||
%post
|
||||
# SELinux boolean named_write_master_zones has to be enabled
|
||||
# otherwise the plugin will not be able to write to /var/named.
|
||||
# This scriptlet enables the boolean after installation or upgrade.
|
||||
# SELinux is sensitive area so I want to inform user about the change.
|
||||
%post
|
||||
if [ -x "/usr/sbin/setsebool" ] ; then
|
||||
echo "Enabling SELinux boolean named_write_master_zones"
|
||||
/usr/sbin/setsebool -P named_write_master_zones=1 || :
|
||||
fi
|
||||
|
||||
# Transform named.conf if it still has old-style API.
|
||||
PLATFORM=$(uname -m)
|
||||
|
||||
if [ $PLATFORM == "x86_64" ] ; then
|
||||
LIBPATH=/usr/lib64
|
||||
else
|
||||
LIBPATH=/usr/lib
|
||||
fi
|
||||
|
||||
# The following sed script:
|
||||
# - scopes the named.conf changes to dynamic-db
|
||||
# - replaces arg "name value" syntax with name "value"
|
||||
# - changes dynamic-db header to dyndb
|
||||
# - uses the new way the define path to the library
|
||||
# - removes no longer supported arguments (library, cache_ttl,
|
||||
# psearch, serial_autoincrement, zone_refresh)
|
||||
while read -r PATTERN
|
||||
do
|
||||
SEDSCRIPT+="$PATTERN"
|
||||
done <<EOF
|
||||
/^\s*dynamic-db/,/};/ {
|
||||
|
||||
s/\(\s*\)arg\s\+\(["']\)\([a-Z_]\+\s\)/\1\3\2/g;
|
||||
|
||||
s/^dynamic-db/dyndb/;
|
||||
|
||||
s@\(dyndb "[^"]\+"\)@\1 "$LIBPATH/bind/ldap.so"@;
|
||||
s@\(dyndb '[^']\+'\)@\1 '$LIBPATH/bind/ldap.so'@;
|
||||
|
||||
/\s*library[^;]\+;/d;
|
||||
/\s*cache_ttl[^;]\+;/d;
|
||||
/\s*psearch[^;]\+;/d;
|
||||
/\s*serial_autoincrement[^;]\+;/d;
|
||||
/\s*zone_refresh[^;]\+;/d;
|
||||
}
|
||||
EOF
|
||||
|
||||
sed -i.bak -e "$SEDSCRIPT" /etc/named.conf
|
||||
|
||||
|
||||
# This scriptlet disables the boolean after uninstallation.
|
||||
%postun
|
||||
@ -76,6 +115,9 @@ rm -rf %{buildroot}
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Feb 09 2017 Tomas Krizek <tkrizek@redhat.com> - 11.0-2
|
||||
- Added named.conf transformation script as post action
|
||||
|
||||
* Thu Dec 15 2016 Tomas Krizek <tkrizek@redhat.com> - 11.0-1
|
||||
- Update to 11.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user