]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/rpms/suse/bacula-bat.spec.in
Fix #1362 about libgcc dependency in sles12 bat package
[bacula/bacula] / bacula / platforms / rpms / suse / bacula-bat.spec.in
1 #
2 # Bacula RPM spec file
3 #
4 #
5 # Copyright (C) 2000-2015 Kern Sibbald
6 # License: BSD 2-Clause; see file LICENSE-FOSS
7 #
8
9 # Platform Build Configuration
10
11 # basic defines for every build
12 %define _release           @RELEASE@
13 %define _version           @VERSION@
14 %define depkgs_qt_version  @DEPKGS_QT_VERSION@
15 %define product            bacula
16
17 # Don't strip binaries
18 %define __os_install_post %{nil}
19 %define __debug_install_post %{nil}
20 %define debug_package %{nil}
21
22 # this is the Qt version in depkgs_qt
23 %define qt4ver             @BQT_VERSION@
24
25 %define _packager Kern Sibbald <kern@sibbald.com>
26
27 %define manpage_ext gz
28
29 # Force single file build
30 %define single_dir 1
31 %{?single_dir_install:%define single_dir 1}
32
33 # Installation Directory locations
34 %if %{single_dir}
35 %define _prefix        /opt/bacula
36 %define _sbindir       /opt/bacula/bin
37 %define _bindir        /opt/bacula/bin
38 %define _subsysdir     /opt/bacula/working
39 %define sqlite_bindir  /opt/bacula/sqlite
40 %define _mandir        /usr/share/man
41 %define docs_dir       /opt/bacula/docs
42 %define archive_dir    /opt/bacula/archive
43 %define sysconf_dir    /opt/bacula/etc
44 %define script_dir     /opt/bacula/scripts
45 %define working_dir    /opt/bacula/working
46 %define pid_dir        /opt/bacula/working
47 %define plugin_dir     /opt/bacula/plugins
48 %define lib_dir        /opt/bacula/lib
49 %else
50 %define _prefix        /usr
51 %define _sbindir       %_prefix/sbin
52 %define _bindir        %_prefix/bin
53 %define _subsysdir     /var/lock/subsys
54 %define sqlite_bindir  %_libdir/bacula/sqlite
55 %define _mandir        %_prefix/share/man
56 %define sysconf_dir    /etc/bacula
57 %define script_dir     %_libdir/bacula
58 %define working_dir    /var/lib/bacula
59 %define pid_dir        /var/run
60 %define plugin_dir     %_libdir/bacula/plugins
61 %define lib_dir        %_libdir/bacula/lib
62 %endif
63
64 # Daemon user:group Don't change them unless you know what you are doing
65 %define director_daemon_user    bacula
66 %define daemon_group            bacula
67
68 #--------------------------------------------------------------------------
69 # it should not be necessary to change anything below here for a release
70 # except for patch macros in the setup section
71 #--------------------------------------------------------------------------
72
73 %{?contrib_packager:%define _packager %{contrib_packager}}
74
75 %{expand: %%define gccver %(rpm -q --queryformat %%{version} gcc)}
76 %{expand: %%define gccrel %(rpm -q --queryformat %%{release} gcc)}
77
78 %define staticqt 1
79 %{?nobuild_staticqt:%define staticqt 0}
80
81 # determine what platform we are building on
82 %define fedora 0
83 %define suse 0
84 %define mdk 0
85
86 %if %{_vendor} == redhat
87         %define fedora 1
88         %define _dist %(cat /etc/redhat-release)
89 %endif
90 %if %{_vendor} == suse
91         %define suse 1
92         %define _dist %(grep -i SuSE /etc/SuSE-release)
93 %endif
94 %if %{_vendor} == Mandriva
95         %define mdk 1
96         %define _dist %(grep Mand /etc/mandrake-release)
97 %endif
98 %if ! %{fedora} && ! %{suse} && ! %{mdk}
99 %{error: Unknown platform. Please examine the spec file.}
100 exit 1
101 %endif
102
103 %define sqlite 0
104 %{?build_sqlite:%define sqlite 1}
105
106 %define base_package_name bacula
107
108 Summary: Bacula - The Network Backup Solution
109 Name: %{base_package_name}-bat
110 Version: %{_version}
111 Release: %{_release}
112 Group: System Environment/Daemons
113 License: AGPLv3
114 BuildRoot: %{_tmppath}/%{name}-root
115 URL: http://www.bacula.org/
116 Vendor: The Bacula Team
117 Packager: %{_packager}
118 Prefix: %{_prefix}
119 Distribution: %{_dist}
120
121 Source0: http://www.prdownloads.sourceforge.net/bacula/%{product}-%{version}.tar.gz
122 Source1: http://www.prdownloads.sourceforge.net/bacula/depkgs-qt-%{depkgs_qt_version}.tar.gz
123
124 BuildRequires: gcc, gcc-c++, make, autoconf
125 BuildRequires: libstdc++-devel = %{gccver}-%{gccrel}, zlib-devel
126 BuildRequires: openssl-devel, fontconfig-devel, libpng-devel, libstdc++-devel, zlib-devel
127
128 Requires: openssl
129 Requires: fontconfig
130 Requires: libpng
131 %if 0%{?suse_version} > 1210
132 Requires: libstdc++.6
133 %else
134 Requires: libstdc++
135 %endif
136 Requires: zlib
137 Requires: %{base_package_name}-libs
138
139 %if %{suse}
140 Requires: freetype2
141 BuildRequires: freetype2-devel
142 %else
143 Requires: usermode
144 Requires: freetype
145 BuildRequires: freetype-devel
146 %endif
147
148 # Source directory locations
149 %define depkgs_qt ../depkgs-qt
150
151 # define the basic package description
152 %define blurb Bacula - The Network Backup Solution.
153 %define blurb2 Bacula is a set of computer programs that permit you (or the system
154 %define blurb3 administrator) to manage backup, recovery, and verification of computer
155 %define blurb4 data across a network of computers of different kinds. In technical terms,
156 %define blurb5 it is a network client/server based backup program. Bacula is relatively
157 %define blurb6 easy to use and efficient, while offering many advanced storage management
158 %define blurb7 features that make it easy to find and recover lost or damaged files.
159
160 %define group_file /etc/group
161 %define groupadd /usr/sbin/groupadd
162
163 Summary: Bacula - The Network Backup Solution
164 Group: System Environment/Daemons
165
166 %description
167 %{blurb}
168
169 %{blurb2}
170 %{blurb3}
171 %{blurb4}
172 %{blurb5}
173 %{blurb6}
174 %{blurb7}
175
176 This is the Bacula Administration Tool (bat) graphical user interface package.
177 It is an add-on to the client or server packages.
178
179 # Don't strip symbols
180 %define debug_package %{nil} 
181
182 # Must explicitly enable debug pkg on SuSE
183 # but not in opensuse_bs
184 #%if %{suse} && ! 0%{?opensuse_bs}
185 #%debug_package
186 #%endif
187
188 %prep
189 %setup -T -n %{product}-%{_version} -b 0
190 %setup -T -D -n %{product}-%{_version} -b 1
191
192 %build
193
194
195 cwd=${PWD}
196 %if ! %{staticqt}
197 export QTDIR=$(pkg-config --variable=prefix QtCore)
198 export QTINC=$(pkg-config --variable=includedir QtCore)
199 export QTLIB=$(pkg-config --variable=libdir QtCore)
200 export PATH=${QTDIR}/bin/:${PATH}
201 %else
202 # You can use a cache for depkgs-qt
203 # tar xfz depkgs-qt*gz -C ~/
204 # cd ~/depkgs-qt
205 # echo yes | make qt4
206 # touch %{depkgs_qt_version}       # depkgs version
207 if [ -f $HOME/depkgs-qt/%{depkgs_qt_version} ]; then
208    rm -rf %{depkgs_qt}
209    ln -s $HOME/depkgs-qt %{depkgs_qt}
210    cd %{depkgs_qt}
211 else
212    cd %{depkgs_qt}
213    make qt4 <<EOF
214 yes
215 EOF
216 fi
217
218 source ./qt4-paths
219 rm -f ${QTLIB}/QtCore.so* ${QTLIB}/QtGUI.so*
220 cd ${cwd}
221
222 %endif
223
224 # hostname is the build hostname, so use XXX_HOSTNAME_XXX for Address parameter
225 sed -i s/hostname/basename/ src/console/bconsole.conf.in src/dird/bacula-dir.conf.in src/qt-console/bat.conf.in
226
227 # Main Bacula configuration with bat
228 %configure \
229         --prefix=%{_prefix} \
230         --sbindir=%{_sbindir} \
231         --sysconfdir=%{sysconf_dir} \
232         --mandir=%{_mandir} \
233         --docdir=%{docs_dir} \
234         --with-archivedir=%{archive_dir} \
235         --with-scriptdir=%{script_dir} \
236         --with-working-dir=%{working_dir} \
237         --with-plugindir=%{script_dir} \
238         --with-pid-dir=%{pid_dir} \
239         --with-subsys-dir=%{_subsysdir} \
240         --enable-smartalloc \
241         --enable-bat \
242         --enable-client-only \
243         --with-dir-user=%{director_daemon_user} \
244         --with-dir-group=%{daemon_group} \
245         --with-sd-user=%{storage_daemon_user} \
246         --with-sd-group=%{storage_daemon_group} \
247         --with-fd-user=%{file_daemon_user} \
248         --with-fd-group=%{daemon_group} \
249         --with-basename="XXX_HOSTNAME_XXX" \
250         --with-hostname="XXX_HOSTNAME_XXX" \
251         --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
252         --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
253         --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
254         --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
255         --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
256         --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
257         --with-openssl
258
259 make
260
261 %install
262 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
263 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
264 %if ! %{suse}
265 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
266 mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
267 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
268 mkdir -p $RPM_BUILD_ROOT/usr/bin
269 %endif
270
271 cd src/qt-console
272 make DESTDIR=$RPM_BUILD_ROOT install
273 cd ../..
274
275 rm -rf $RPM_BUILD_ROOT%{_prefix}/share/doc/bacula
276
277 %if %{suse}
278 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
279 cp -p scripts/bat.desktop.xsu $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
280 touch $RPM_BUILD_ROOT%{sysconf_dir}/bat.kdesu
281 %else
282 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
283 cp -p scripts/bat.desktop.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
284 cp -p scripts/bat.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/bat
285 cp -p scripts/bat.pamd $RPM_BUILD_ROOT/etc/pam.d/bat
286 ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/bat
287 %endif
288
289 %files
290 %defattr(-,root,root)
291 %attr(-, root, %{daemon_group}) %{_sbindir}/bat
292 %attr(770, root, %{daemon_group}) %dir %{sysconf_dir}
293 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bat.conf
294 %attr(-, root, %{daemon_group}) %{docs_dir}/*.html
295 %attr(-, root, %{daemon_group}) %{docs_dir}/*.png
296 /usr/share/pixmaps/bat_icon.png
297 /usr/share/applications/bat.desktop
298
299 # if user is a member of daemon_group then kdesu will run bat as user
300 %if %{suse}
301 %attr(0660, root, %{daemon_group}) %{sysconf_dir}/bat.kdesu
302 %endif
303
304 %if ! %{suse}
305 # add the console helper files
306 %config(noreplace,missingok) /etc/pam.d/bat
307 %config(noreplace,missingok) /etc/security/console.apps/bat
308 /usr/bin/bat
309 %endif
310
311
312
313 %pre
314 # create the daemon group
315 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
316 if [ -z "$HAVE_BACULA" ]; then
317     %{groupadd} -r %{daemon_group} > /dev/null 2>&1
318     echo "The group %{daemon_group} has been added to %{group_file}."
319     echo "See the manual chapter \"Running Bacula\" for details."
320 fi
321
322
323 %post
324 if [ -d %{sysconf_dir} ]; then
325    cd %{sysconf_dir}
326    if [ ! -f .rpm.sed ]; then
327        (umask 0177
328         echo "# This file is used to ensure that all passwords will" > .rpm.sed
329         echo "# match between configuration files"                  >> .rpm.sed
330        )
331        for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
332            pass=`openssl rand -base64 33`
333            echo "s@${string}@${pass}@g" >> .rpm.sed
334        done
335    fi
336    host=`hostname -s`
337    for file in *.conf; do
338       sed -f .rpm.sed $file > $file.new
339       sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
340       rm -f $file.new
341    done
342 fi
343 /sbin/ldconfig
344
345 %clean
346 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
347 rm -rf $RPM_BUILD_DIR/depkgs-qt
348
349 %changelog
350 * Sat Aug 1 2009 Kern Sibbald <kern@sibbald.com>
351 - Split bat into separate bacula-bat.spec