5 # Copyright (C) 2000-2015 Kern Sibbald
6 # License: BSD 2-Clause; see file LICENSE-FOSS
9 # Platform Build Configuration
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
17 # Don't strip binaries
18 %define __os_install_post %{nil}
19 %define __debug_install_post %{nil}
20 %define debug_package %{nil}
22 # this is the Qt version in depkgs_qt
23 %define qt4ver @BQT_VERSION@
25 %define _packager Kern Sibbald <kern@sibbald.com>
27 %define manpage_ext gz
29 # Force single file build
31 %{?single_dir_install:%define single_dir 1}
33 # Installation Directory locations
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
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
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
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 #--------------------------------------------------------------------------
73 %{?contrib_packager:%define _packager %{contrib_packager}}
75 %{expand: %%define gccver %(rpm -q --queryformat %%{version} gcc)}
76 %{expand: %%define gccrel %(rpm -q --queryformat %%{release} gcc)}
79 %{?nobuild_staticqt:%define staticqt 0}
81 # determine what platform we are building on
86 %if %{_vendor} == redhat
88 %define _dist %(cat /etc/redhat-release)
90 %if %{_vendor} == suse
92 %define _dist %(grep -i SuSE /etc/SuSE-release)
94 %if %{_vendor} == Mandriva
96 %define _dist %(grep Mand /etc/mandrake-release)
98 %if ! %{fedora} && ! %{suse} && ! %{mdk}
99 %{error: Unknown platform. Please examine the spec file.}
104 %{?build_sqlite:%define sqlite 1}
106 %define base_package_name bacula
108 Summary: Bacula - The Network Backup Solution
109 Name: %{base_package_name}-bat
112 Group: System Environment/Daemons
114 BuildRoot: %{_tmppath}/%{name}-root
115 URL: http://www.bacula.org/
116 Vendor: The Bacula Team
117 Packager: %{_packager}
119 Distribution: %{_dist}
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
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
132 %if 0%{?suse_version} > 1210
133 Requires: libstdc++.6
138 Requires: %{base_package_name}-libs
142 BuildRequires: freetype2-devel
146 BuildRequires: freetype-devel
149 # Source directory locations
150 %define depkgs_qt ../depkgs-qt
152 # define the basic package description
153 %define blurb Bacula - The Network Backup Solution.
154 %define blurb2 Bacula is a set of computer programs that permit you (or the system
155 %define blurb3 administrator) to manage backup, recovery, and verification of computer
156 %define blurb4 data across a network of computers of different kinds. In technical terms,
157 %define blurb5 it is a network client/server based backup program. Bacula is relatively
158 %define blurb6 easy to use and efficient, while offering many advanced storage management
159 %define blurb7 features that make it easy to find and recover lost or damaged files.
161 %define group_file /etc/group
162 %define groupadd /usr/sbin/groupadd
164 Summary: Bacula - The Network Backup Solution
165 Group: System Environment/Daemons
177 This is the Bacula Administration Tool (bat) graphical user interface package.
178 It is an add-on to the client or server packages.
180 # Don't strip symbols
181 %define debug_package %{nil}
183 # Must explicitly enable debug pkg on SuSE
184 # but not in opensuse_bs
185 #%if %{suse} && ! 0%{?opensuse_bs}
190 %setup -T -n %{product}-%{_version} -b 0
191 %setup -T -D -n %{product}-%{_version} -b 1
198 export QTDIR=$(pkg-config --variable=prefix QtCore)
199 export QTINC=$(pkg-config --variable=includedir QtCore)
200 export QTLIB=$(pkg-config --variable=libdir QtCore)
201 export PATH=${QTDIR}/bin/:${PATH}
203 # You can use a cache for depkgs-qt
204 # tar xfz depkgs-qt*gz -C ~/
206 # echo yes | make qt4
207 # touch %{depkgs_qt_version} # depkgs version
208 if [ -f $HOME/depkgs-qt/%{depkgs_qt_version} ]; then
210 ln -s $HOME/depkgs-qt %{depkgs_qt}
220 rm -f ${QTLIB}/QtCore.so* ${QTLIB}/QtGUI.so*
225 # hostname is the build hostname, so use XXX_HOSTNAME_XXX for Address parameter
226 sed -i s/hostname/basename/ src/console/bconsole.conf.in src/dird/bacula-dir.conf.in src/qt-console/bat.conf.in
228 # Main Bacula configuration with bat
230 --prefix=%{_prefix} \
231 --sbindir=%{_sbindir} \
232 --sysconfdir=%{sysconf_dir} \
233 --mandir=%{_mandir} \
234 --docdir=%{docs_dir} \
235 --with-archivedir=%{archive_dir} \
236 --with-scriptdir=%{script_dir} \
237 --with-working-dir=%{working_dir} \
238 --with-plugindir=%{script_dir} \
239 --with-pid-dir=%{pid_dir} \
240 --with-subsys-dir=%{_subsysdir} \
241 --enable-smartalloc \
243 --enable-client-only \
244 --with-dir-user=%{director_daemon_user} \
245 --with-dir-group=%{daemon_group} \
246 --with-sd-user=%{storage_daemon_user} \
247 --with-sd-group=%{storage_daemon_group} \
248 --with-fd-user=%{file_daemon_user} \
249 --with-fd-group=%{daemon_group} \
250 --with-basename="XXX_HOSTNAME_XXX" \
251 --with-hostname="XXX_HOSTNAME_XXX" \
252 --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
253 --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
254 --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
255 --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
256 --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
257 --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
263 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
264 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
266 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
267 mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
268 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
269 mkdir -p $RPM_BUILD_ROOT/usr/bin
273 make DESTDIR=$RPM_BUILD_ROOT install
276 rm -rf $RPM_BUILD_ROOT%{_prefix}/share/doc/bacula
279 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
280 cp -p scripts/bat.desktop.xsu $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
281 touch $RPM_BUILD_ROOT%{sysconf_dir}/bat.kdesu
283 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
284 cp -p scripts/bat.desktop.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
285 cp -p scripts/bat.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/bat
286 cp -p scripts/bat.pamd $RPM_BUILD_ROOT/etc/pam.d/bat
287 ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/bat
291 %defattr(-,root,root)
292 %attr(-, root, %{daemon_group}) %{_sbindir}/bat
293 %attr(770, root, %{daemon_group}) %dir %{sysconf_dir}
294 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bat.conf
295 %attr(-, root, %{daemon_group}) %{docs_dir}/*.html
296 %attr(-, root, %{daemon_group}) %{docs_dir}/*.png
297 /usr/share/pixmaps/bat_icon.png
298 /usr/share/applications/bat.desktop
300 # if user is a member of daemon_group then kdesu will run bat as user
302 %attr(0660, root, %{daemon_group}) %{sysconf_dir}/bat.kdesu
306 # add the console helper files
307 %config(noreplace,missingok) /etc/pam.d/bat
308 %config(noreplace,missingok) /etc/security/console.apps/bat
315 # create the daemon group
316 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
317 if [ -z "$HAVE_BACULA" ]; then
318 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
319 echo "The group %{daemon_group} has been added to %{group_file}."
320 echo "See the manual chapter \"Running Bacula\" for details."
325 if [ -d %{sysconf_dir} ]; then
327 if [ ! -f .rpm.sed ]; then
329 echo "# This file is used to ensure that all passwords will" > .rpm.sed
330 echo "# match between configuration files" >> .rpm.sed
332 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
333 pass=`openssl rand -base64 33`
334 echo "s@${string}@${pass}@g" >> .rpm.sed
338 for file in *.conf; do
339 sed -f .rpm.sed $file > $file.new
340 sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
347 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
348 rm -rf $RPM_BUILD_DIR/depkgs-qt
351 * Sat Aug 1 2009 Kern Sibbald <kern@sibbald.com>
352 - Split bat into separate bacula-bat.spec