isc-bind.spec 3.78 KB
Newer Older
Michał Kępień's avatar
Michał Kępień committed
1
2
%global nfsmountable 1

Michał Kępień's avatar
Michał Kępień committed
3
4
5
6
7
8
9
10
11
12
13
%global _scl_prefix /opt/isc

%global scl_name_prefix isc-
%global scl_name_base bind

%global scl %{scl_name_prefix}%{scl_name_base}

%scl_package %scl

Summary: Package that installs %scl
Name: %scl_name
Michał Kępień's avatar
Michał Kępień committed
14
Epoch: 1
Michał Kępień's avatar
Michał Kępień committed
15
Version: 2
16
Release: 2%{?dist}
Michał Kępień's avatar
Michał Kępień committed
17
18
19
License: MPL 2.0
Requires: %{scl_prefix}bind
Requires: %{scl_prefix}bind-utils
20
21
22
%if 0%{?rhel} >= 8
Requires: policycoreutils-python-utils
%else
Michał Kępień's avatar
Michał Kępień committed
23
Requires: policycoreutils-python
24
%endif
Michał Kępień's avatar
Michał Kępień committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
BuildRequires: scl-utils-build

%description
This is the main package for %scl Software Collection.

%package runtime
Summary: Package that handles %scl Software Collection.
Requires: scl-utils

%description runtime
Package shipping essential scripts to work with %scl Software Collection.

%package build
Summary: Package shipping basic build configuration
Requires: scl-utils-build

%description build
Package shipping essential configuration macros to build %scl Software Collection.

%prep
%setup -c -T

%install
%scl_install

cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config <<EOF
%%_scl_prefix %{_scl_prefix}
EOF

cat > %{buildroot}%{_scl_scripts}/enable <<EOF
export PATH="%{_bindir}:%{_sbindir}\${PATH:+:\${PATH}}"
export LD_LIBRARY_PATH="%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}"
export MANPATH="%{_mandir}\${MANPATH:+:\${MANPATH}}"
EOF

%files

%files runtime
%scl_files

%files build
%{_root_sysconfdir}/rpm/macros.%{scl}-config

%post
Michał Kępień's avatar
Michał Kępień committed
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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
Michał Kępień's avatar
Michał Kępień committed
115
fi
Michał Kępień's avatar
Michał Kępień committed
116
117
118
119
120
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 || :
Michał Kępień's avatar
Michał Kępień committed
121
122
123
124

%postun
if [ "$1" -eq 0 ]; then
	# Package removal, not upgrade
Michał Kępień's avatar
Michał Kępień committed
125
126
127
	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 || :
Michał Kępień's avatar
Michał Kępień committed
128
fi