summaryrefslogtreecommitdiff
path: root/packaging/buxton2.spec
blob: 0966051afd59693d7b3229ad3d73ced93d62383e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
%define dbdir %{_localstatedir}/lib/%{name}
%define basedbdir %{_sysconfdir}/%{name}
%define upgrade_script_path /usr/share/upgrade/scripts

Name:           buxton2
Version:        1.5.9
Release:        0
License:        Apache-2.0
Summary:        A security-enabled configuration system
Group:          System/Configuration
Source0:        %{name}-%{version}.tar.gz
Source1:        %{name}.conf
Source2:        %{name}.service
Source3:        %{name}.socket
Source4:        %{name}.tmpfiles.conf
Source1001:     %{name}.manifest
BuildRequires:  cmake
BuildRequires:  gdbm-devel
BuildRequires:  pkgconfig(gio-2.0)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(cynara-client-async)
BuildRequires:  pkgconfig(dlog)
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  pkgconfig(libtzplatform-config)
Requires:       security-config
Requires(post): /usr/bin/getent
Requires(post): /usr/bin/chown
Requires(post): /usr/sbin/useradd
Requires(post): /usr/sbin/groupadd
Requires(post): /usr/bin/chsmack
Requires(posttrans): /usr/bin/chsmack
Requires(posttrans): /usr/bin/chmod
Obsoletes:      buxton
Provides:       buxton

%description
Buxton is a security-enabled configuration management system. It
features a layered approach to configuration storage, with each
layer containing key-value pairs. Mandatory Access Control (MAC) is
implemented at the key-value level. Cynara is used as default for MAC.

Buxton provides a C library (libbuxton) for client applications to
use. Internally, buxton uses a daemon (buxtond) for processing
client requests and enforcing MAC. Also, a CLI (buxtonctl) is
provided for interactive use and for use in shell scripts.

%package devel
Summary: A security-enabled configuration system - development files
Requires: %{name} = %{version}

%description devel
Buxton is a security-enabled configuration management system. It
features a layered approach to configuration storage, with each
layer containing key-value pairs. Mandatory Access Control (MAC) is
implemented at the key-value level. Cynara is used as default for MAC.

Buxton provides a C library (libbuxton) for client applications to
use. Internally, buxton uses a daemon (buxtond) for processing
client requests and enforcing MAC. Also, a CLI (buxtonctl) is
provided for interactive use and for use in shell scripts.

This package provides development files for Buxton.


%package -n vconf-compat
Summary:       buxton wrapper for vconf APIs
Requires:      %{name} = %{version}
Requires:      /usr/bin/getopt
Obsoletes:     vconf-buxton
Obsoletes:     vconf
Obsoletes:     vconf-keys
Provides:      vconf-buxton
Provides:      vconf
Provides:      vconf-keys

%description -n vconf-compat
Buxton wrapper library for providing vconf APIs


%package -n vconf-compat-devel
Summary:       buxton wrapper for vconf APIs (devel)
Requires:      vconf-compat = %{version}
Requires:      vconf-internal-keys-devel
BuildRequires: pkgconfig(vconf-internal-keys)
Obsoletes:     vconf-buxton-devel
Obsoletes:     vconf-buxton-keys-devel
Obsoletes:     vconf-devel
Obsoletes:     vconf-keys-devel
Provides:      vconf-buxton-devel
Provides:      vconf-buxton-keys-devel
Provides:      vconf-devel
Provides:      vconf-keys-devel

%description -n vconf-compat-devel
Buxton wrapper library for providing vconf APIs (devel)

%if 0%{?gcov:1}
%package gcov
Summary:  buxton wrapper for vconf APIs (gcov)
Group:    Application Framework/API

%description gcov
gcov objects for a buxton2 library
%endif


%prep
%setup -q
cp %{SOURCE1001} .

%build
%if 0%{?gcov:1}
export CFLAGS+=" -fprofile-arcs -ftest-coverage"
export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
export FFLAGS+=" -fprofile-arcs -ftest-coverage"
export LDFLAGS+=" -lgcov"
%endif

# for Address space layout randomization
export CFLAGS="$CFLAGS -fPIE"
export LDFLAGS="$LDFLAGS -pie"

%cmake -DVERSION=%{version} \
	-DCONFPATH:PATH=%{_sysconfdir}/%{name}.conf \
	-DMODULE_DIR:PATH=%{_libdir}/%{name} \
	-DBASE_DB_DIR:PATH=%{basedbdir} \
	-DDB_DIR:PATH=%{_localstatedir}/lib/%{name} \
	-DTMPFS_DIR:PATH=/run/%{name} \
	-DSOCKPATH:PATH=/run/%{name}-0 \
	-DNDEBUG:BOOL=FALSE \
	-DDEBUG_LOG:BOOL=FALSE \
	.

%__make %{?_smp_mflags}

%if 0%{?gcov:1}
mkdir -p gcov-obj
find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
%endif

%install
%make_install

# create the database directory
install -m 700 -d %{buildroot}%{basedbdir}
install -m 700 -d %{buildroot}%{_localstatedir}/lib/%{name}

# install config file
install -m 755 -d %{buildroot}%{_sysconfdir}
install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{name}.conf

# install systemd unit files
install -m 755 -d %{buildroot}%{_unitdir}
install -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
install -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/%{name}.socket
install -m 755 -d %{buildroot}%{_tmpfilesdir}
install -m 644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/%{name}.conf

install -m 755 -d %{buildroot}%{_unitdir}/basic.target.wants
ln -sf ../%{name}.service %{buildroot}%{_unitdir}/basic.target.wants/

# enable socket activation
install -m 755 -d %{buildroot}%{_unitdir}/sockets.target.wants
ln -sf ../%{name}.socket %{buildroot}%{_unitdir}/sockets.target.wants/

mkdir -p %{buildroot}%{upgrade_script_path}
cp -f scripts/290.buxton2_upgrade.sh %{buildroot}%{upgrade_script_path}

%if 0%{?gcov:1}
mkdir -p %{buildroot}%{_datadir}/gcov/obj
install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
%endif

%post
/sbin/ldconfig

# buxtond runs as user buxton of group buxton
# create it on need!
getent group buxton > /dev/null || groupadd -r -g 375 buxton 2> /dev/null
getent passwd buxton > /dev/null || useradd -c "buxton" -u 375 -g 375 \
		                            -s /sbin/nologin -r -d /var/lib/empty buxton 2> /dev/null

# The initial DBs will not have the correct labels and
# permissions when created in postinstall during image
# creation, so we set these file attributes here.
chown -R buxton:buxton "%{basedbdir}"
chsmack -a System "%{basedbdir}"
chsmack -t "%{basedbdir}"

chown -R buxton:buxton "%{dbdir}"
chsmack -a System "%{dbdir}"
chsmack -t "%{dbdir}"

%posttrans
chown -R buxton:buxton "%{basedbdir}"
chmod 0600 %{basedbdir}/*
chsmack -a System %{basedbdir}/*

chown -R buxton:buxton "%{dbdir}"
chmod 0600 %{dbdir}/*
chsmack -a System %{dbdir}/*

%postun -p /sbin/ldconfig

%post -n vconf-compat -p /sbin/ldconfig

%postun -n vconf-compat -p /sbin/ldconfig

%files
%manifest %{name}.manifest
%license LICENSE.Apache-2.0
%config(noreplace) %{_sysconfdir}/%{name}.conf
%attr(0750,root,system_share) %{_bindir}/buxton2ctl
%{_sbindir}/buxton2d
%{_libdir}/%{name}/*.so
%{_libdir}/libbuxton2.so.*
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}.socket
%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/sockets.target.wants/%{name}.socket
%{_unitdir}/basic.target.wants/%{name}.service
%attr(0700,buxton,buxton) %dir %{_localstatedir}/lib/%{name}
%attr(0700,buxton,buxton) %dir %{basedbdir}
%attr(0750,root,root) %{upgrade_script_path}/290.buxton2_upgrade.sh
%attr(0750,root,root) /opt/etc/dump.d/module.d/buxton_dump.sh

%files devel
%manifest %{name}.manifest
%{_includedir}/buxton2.h
%{_libdir}/libbuxton2.so
%{_libdir}/pkgconfig/buxton2.pc

%files -n vconf-compat
%manifest %{name}.manifest
%license LICENSE.Apache-2.0
%attr(0750,root,system_share) %{_bindir}/vconftool
%{_libdir}/libvconf.so.*

%files -n vconf-compat-devel
%manifest %{name}.manifest
%{_includedir}/vconf/vconf.h
%{_includedir}/vconf/vconf-keys.h
%{_libdir}/libvconf.so
%{_libdir}/pkgconfig/vconf.pc

%if 0%{?gcov:1}
%files gcov
%{_datadir}/gcov/obj/*
%endif