4 # Copyright (C) 2000-2014 Bacula Systems SA
7 # Platform Build Configuration
9 # basic defines for every build
10 %define _release @RELEASE@
11 %define _version @VERSION@
12 %define depkgs_qt_version @DEPKGS_QT_VERSION@
13 %define product bacula
14 %define base_package_name %{product}
16 # Don't strip binaries
17 %define __os_install_post %{nil}
18 %define __debug_install_post %{nil}
19 %define debug_package %{nil}
21 # this is the Qt version in depkgs_qt
22 %define qt4ver @BQT_VERSION@
24 %define _packager Kern Sibbald <kern@sibbald.com>
26 %define manpage_ext gz
28 # Force single file build
30 %{?single_dir_install:%define single_dir 1}
32 # Installation Directory locations
34 %define _prefix /opt/bacula
35 %define _sbindir /opt/bacula/bin
36 %define _bindir /opt/bacula/bin
37 %define _subsysdir /opt/bacula/working
38 %define sqlite_bindir /opt/bacula/sqlite
39 %define _mandir /usr/share/man
40 %define docs_dir /opt/bacula/docs
41 %define archive_dir /opt/bacula/archive
42 %define sysconf_dir /opt/bacula/etc
43 %define script_dir /opt/bacula/scripts
44 %define working_dir /opt/bacula/working
45 %define pid_dir /opt/bacula/working
46 %define plugin_dir /opt/bacula/plugins
47 %define lib_dir /opt/bacula/lib
50 %define _sbindir %_prefix/sbin
51 %define _bindir %_prefix/bin
52 %define _subsysdir /var/lock/subsys
53 %define sqlite_bindir %_libdir/bacula/sqlite
54 %define _mandir %_prefix/share/man
55 %define sysconf_dir /etc/bacula
56 %define script_dir %_libdir/bacula
57 %define working_dir /var/lib/bacula
58 %define pid_dir /var/run
59 %define plugin_dir %_libdir/bacula/plugins
60 %define lib_dir %_libdir/bacula/lib
63 # Daemon user:group Don't change them unless you know what you are doing
64 %define director_daemon_user bacula
65 %define daemon_group bacula
67 #--------------------------------------------------------------------------
68 # it should not be necessary to change anything below here for a release
69 # except for patch macros in the setup section
70 #--------------------------------------------------------------------------
72 %{?contrib_packager:%define _packager %{contrib_packager}}
74 %{expand: %%define gccver %(rpm -q --queryformat %%{version} gcc)}
75 %{expand: %%define gccrel %(rpm -q --queryformat %%{release} gcc)}
78 %{?nobuild_staticqt:%define staticqt 0}
80 # determine what platform we are building on
85 %if %{_vendor} == redhat
87 %define _dist %(cat /etc/redhat-release)
89 %if %{_vendor} == suse
91 %define _dist %(grep -i SuSE /etc/SuSE-release)
93 %if %{_vendor} == Mandriva
95 %define _dist %(grep Mand /etc/mandrake-release)
97 %if ! %{fedora} && ! %{suse} && ! %{mdk}
98 %{error: Unknown platform. Please examine the spec file.}
103 %{?build_sqlite:%define sqlite 1}
105 Summary: Bacula - The Network Backup Solution
106 Name: %{base_package_name}-bat
109 Group: System Environment/Daemons
111 BuildRoot: %{_tmppath}/%{name}-root
112 URL: http://www.bacula.org/
113 Vendor: The Bacula Team
114 Packager: %{_packager}
116 Distribution: %{_dist}
118 Source0: http://www.prdownloads.sourceforge.net/bacula/%{product}-%{version}.tar.gz
119 Source1: http://www.prdownloads.sourceforge.net/bacula/depkgs-qt-%{depkgs_qt_version}.tar.gz
121 BuildRequires: gcc, gcc-c++, make, autoconf
122 BuildRequires: libstdc++-devel = %{gccver}-%{gccrel}, zlib-devel
123 BuildRequires: openssl-devel, fontconfig-devel, libpng-devel, libstdc++-devel, zlib-devel
131 Requires: %{base_package_name}-libs
135 BuildRequires: freetype2-devel
139 BuildRequires: freetype-devel
142 # Source directory locations
143 %define depkgs_qt ../depkgs-qt
145 # define the basic package description
146 %define blurb Bacula - The Leading Open Source Backup Solution.
147 %define blurb2 Bacula is a set of computer programs that permit you (or the system
148 %define blurb3 administrator) to manage backup, recovery, and verification of computer
149 %define blurb4 data across a network of computers of different kinds. In technical terms,
150 %define blurb5 it is a network client/server based backup program. Bacula is relatively
151 %define blurb6 easy to use and efficient, while offering many advanced storage management
152 %define blurb7 features that make it easy to find and recover lost or damaged files.
153 %define blurb8 Bacula source code has been released under the AGPL version 3 license.
155 %define group_file /etc/group
156 %define groupadd /usr/sbin/groupadd
158 Summary: Bacula - The Network Backup Solution
159 Group: System Environment/Daemons
172 This is the Bacula Administration Tool (bat) graphical user interface package.
173 It is an add-on to the client or server packages.
175 # Don't strip symbols
176 %define debug_package %{nil}
178 # Must explicitly enable debug pkg on SuSE
179 # but not in opensuse_bs
180 #%if %{suse} && ! 0%{?opensuse_bs}
185 %setup -T -n %{product}-%{_version} -b 0
186 %setup -T -D -n %{product}-%{_version} -b 1
193 export QTDIR=$(pkg-config --variable=prefix QtCore)
194 export QTINC=$(pkg-config --variable=includedir QtCore)
195 export QTLIB=$(pkg-config --variable=libdir QtCore)
196 export PATH=${QTDIR}/bin/:${PATH}
198 # You can use a cache for depkgs-qt
199 # tar xfz depkgs-qt*gz -C ~/
201 # echo yes | make qt4
202 # touch %{depkgs_qt_version} # depkgs version
203 if [ -f $HOME/depkgs-qt/%{depkgs_qt_version} ]; then
205 ln -s $HOME/depkgs-qt %{depkgs_qt}
215 rm -f ${QTLIB}/QtCore.so* ${QTLIB}/QtGUI.so*
220 # hostname is the build hostname, so use XXX_HOSTNAME_XXX for Address parameter
221 sed -i s/hostname/basename/ src/console/bconsole.conf.in src/dird/bacula-dir.conf.in src/qt-console/bat.conf.in
223 # Main Bacula configuration with bat
225 --prefix=%{_prefix} \
226 --sbindir=%{_sbindir} \
227 --sysconfdir=%{sysconf_dir} \
228 --mandir=%{_mandir} \
229 --docdir=%{docs_dir} \
230 --with-archivedir=%{archive_dir} \
231 --with-scriptdir=%{script_dir} \
232 --with-working-dir=%{working_dir} \
233 --with-plugindir=%{script_dir} \
234 --with-pid-dir=%{pid_dir} \
235 --with-subsys-dir=%{_subsysdir} \
236 --enable-smartalloc \
238 --enable-client-only \
239 --with-dir-user=%{director_daemon_user} \
240 --with-dir-group=%{daemon_group} \
241 --with-sd-user=%{storage_daemon_user} \
242 --with-sd-group=%{storage_daemon_group} \
243 --with-fd-user=%{file_daemon_user} \
244 --with-fd-group=%{daemon_group} \
245 --with-basename="XXX_HOSTNAME_XXX" \
246 --with-hostname="XXX_HOSTNAME_XXX" \
247 --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
248 --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
249 --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
250 --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
251 --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
252 --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
258 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
259 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
261 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
262 mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
263 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
264 mkdir -p $RPM_BUILD_ROOT/usr/bin
268 make DESTDIR=$RPM_BUILD_ROOT install
271 rm -rf $RPM_BUILD_ROOT%{_prefix}/share/doc/bacula
274 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
275 cp -p scripts/bat.desktop.xsu $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
276 touch $RPM_BUILD_ROOT%{sysconf_dir}/bat.kdesu
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.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
280 cp -p scripts/bat.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/bat
281 cp -p scripts/bat.pamd $RPM_BUILD_ROOT/etc/pam.d/bat
282 ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/bat
286 %defattr(-,root,root)
287 %attr(-, root, %{daemon_group}) %{_sbindir}/bat
288 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
289 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bat.conf
290 %attr(-, root, %{daemon_group}) %{docs_dir}/*.html
291 %attr(-, root, %{daemon_group}) %{docs_dir}/*.png
292 /usr/share/pixmaps/bat_icon.png
293 /usr/share/applications/bat.desktop
295 # if user is a member of daemon_group then kdesu will run bat as user
297 %attr(0660, root, %{daemon_group}) %{sysconf_dir}/bat.kdesu
301 # add the console helper files
302 %config(noreplace,missingok) /etc/pam.d/bat
303 %config(noreplace,missingok) /etc/security/console.apps/bat
310 # create the daemon group
311 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
312 if [ -z "$HAVE_BACULA" ]; then
313 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
314 echo "The group %{daemon_group} has been added to %{group_file}."
315 echo "See the manual chapter \"Running Bacula\" for details."
320 if [ -d %{sysconf_dir} ]; then
322 if [ ! -f .rpm.sed ]; then
324 echo "# This file is used to ensure that all passwords will" > .rpm.sed
325 echo "# match between configuration files" >> .rpm.sed
327 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
328 pass=`openssl rand -base64 33`
329 echo "s@${string}@${pass}@g" >> .rpm.sed
333 for file in *.conf; do
334 sed -f .rpm.sed $file > $file.new
335 sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file
342 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
343 rm -rf $RPM_BUILD_DIR/depkgs-qt
346 * Sat Aug 1 2009 Kern Sibbald <kern@sibbald.com>
347 - Split bat into separate bacula-bat.spec