Commit 00fef0f9 authored by Michał Kępień's avatar Michał Kępień

Set "nfsmountable"

This makes the directory layout used by the BIND Software Collection
comply with the Filesystem Hierarchy Standard (FHS).  Add a migration
script attempting to automatically perform all the necessary changes.
parent 5763b299
%global nfsmountable 1
%global _scl_prefix /opt/isc
%global scl_name_prefix isc-
......@@ -10,7 +12,7 @@
Summary: Package that installs %scl
Name: %scl_name
Epoch: 1
Version: 1
Version: 2
Release: 1%{?dist}
License: MPL 2.0
Requires: %{scl_prefix}bind
......@@ -60,15 +62,63 @@ EOF
%{_root_sysconfdir}/rpm/macros.%{scl}-config
%post
if [ "$1" -eq 1 ]; then
# Initial installation, not upgrade
semanage fcontext -a -e / %{_scl_root}
restorecon -R %{_scl_root}
selinuxenabled && load_policy || true
DIR_LAYOUT_MODIFIED="no"
if [ -d %{_scl_root}/etc ]; then
mv %{_sysconfdir} %{_sysconfdir}.rpmnew
mv %{_scl_root}/etc %{_sysconfdir}
DIR_LAYOUT_MODIFIED="yes"
fi
if [ -d %{_scl_root}/var ]; then
mv %{_localstatedir} %{_localstatedir}.rpmnew
mv %{_scl_root}/var %{_localstatedir}
%{?tmpfiles_create:%{tmpfiles_create %{scl}-named.conf}}
DIR_LAYOUT_MODIFIED="yes"
fi
if [ "${DIR_LAYOUT_MODIFIED}" = "yes" ]; then
sed -i.rpmsave "s|%{_scl_root}/etc|%{_sysconfdir}|g; s|%{_scl_root}/var|%{_localstatedir}|g" %{_sysconfdir}/named.conf
TEMPFILE="$(mktemp)"
cat > "${TEMPFILE}" <<-EOF
This update of the BIND Software Collection changes the directory layout of the
previously installed BIND packages so that it complies with the Filesystem
Hierarchy Standard (FHS).
The post-installation scriptlet for this update attempted to move the following
directories:
%{_scl_root}/etc -> %{_sysconfdir}
%{_scl_root}/var -> %{_localstatedir}
Your original named.conf file was modified to reflect the above change, with a
backup of the original file saved as named.conf.rpmsave in the same directory.
Please check whether the result of these automatic modifications matches your
expectations by examining the contents of:
%{_sysconfdir}/named.conf
You might also need to manually update configuration files included by the above
file (if any) as they are not updated automatically.
Please note that since file paths changed, you might also need to update
resources (scripts, automation recipes, etc.) external to BIND.
This is a one-time event - there are no plans for similar changes to be required
upon future updates to the BIND Software Collection.
Any "No such file or directory" warnings logged by the package manager during
this update are safe to ignore.
EOF
echo "warning: BIND directory layout changed; please read ${TEMPFILE} for more information" > /dev/stderr
fi
semanage fcontext -a -e / %{_scl_root} 2>/dev/null || :
semanage fcontext -a -e /etc %{_sysconfdir} 2>/dev/null || :
semanage fcontext -a -e /var %{_localstatedir} 2>/dev/null || :
restorecon -R %{_scl_root} %{_sysconfdir} %{_localstatedir} || :
selinuxenabled && load_policy || :
%postun
if [ "$1" -eq 0 ]; then
# Package removal, not upgrade
semanage fcontext -d -e / %{_scl_root}
semanage fcontext -d -e / %{_scl_root} 2>/dev/null || :
semanage fcontext -d -e /etc %{_sysconfdir} 2>/dev/null || :
semanage fcontext -d -e /var %{_localstatedir} 2>/dev/null || :
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment