3 # Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
5 # Platform Build Configuration
7 # basic defines for every build
10 %define depkgs_qt_version 28Jul09
12 # this is the QT version in depkgs_qt
15 %define _packager D. Scott Barninger <barninger@fairfieldcomputers.com>
17 %define manpage_ext gz
20 %{?single_dir_install:%define single_dir 1}
22 # Installation Directory locations
24 %define _prefix /opt/bacula
25 %define _sbindir /opt/bacula/bin
26 %define _bindir /opt/bacula/bin
27 %define _subsysdir /opt/bacula/working
28 %define sqlite_bindir /opt/bacula/sqlite
29 %define _mandir /usr/share/man
30 %define sysconf_dir /opt/bacula/etc
31 %define script_dir /opt/bacula/scripts
32 %define working_dir /opt/bacula/working
33 %define pid_dir /opt/bacula/working
34 %define plugin_dir /opt/bacula/plugins
35 %define lib_dir /opt/bacula/lib
38 %define _sbindir %_prefix/sbin
39 %define _bindir %_prefix/bin
40 %define _subsysdir /var/lock/subsys
41 %define sqlite_bindir %_libdir/bacula/sqlite
42 %define _mandir %_prefix/share/man
43 %define sysconf_dir /etc/bacula
44 %define script_dir %_libdir/bacula
45 %define working_dir /var/lib/bacula
46 %define pid_dir /var/run
47 %define plugin_dir %_libdir/bacula/plugins
48 %define lib_dir %_libdir/bacula/lib
51 # Daemon user:group Don't change them unless you know what you are doing
52 %define director_daemon_user bacula
53 %define daemon_group bacula
55 #--------------------------------------------------------------------------
56 # it should not be necessary to change anything below here for a release
57 # except for patch macros in the setup section
58 #--------------------------------------------------------------------------
60 %{?contrib_packager:%define _packager %{contrib_packager}}
62 %{expand: %%define gccver %(rpm -q --queryformat %%{version} gcc)}
63 %{expand: %%define gccrel %(rpm -q --queryformat %%{release} gcc)}
65 # determine what platform we are building on
70 %if %{_vendor} == redhat
72 %define _dist %(cat /etc/redhat-release)
74 %if %{_vendor} == suse
76 %define _dist %(grep -i SuSE /etc/SuSE-release)
78 %if %{_vendor} == Mandriva
80 %define _dist %(grep Mand /etc/mandrake-release)
82 %if ! %{fedora} && ! %{suse} && ! %{mdk}
83 %{error: Unknown platform. Please examine the spec file.}
87 Summary: Bacula - The Network Backup Solution
91 Group: System Environment/Daemons
93 BuildRoot: %{_tmppath}/%{name}-root
94 URL: http://www.bacula.org/
95 Vendor: The Bacula Team
96 Packager: %{_packager}
98 Distribution: %{_dist}
100 Source0: http://www.prdownloads.sourceforge.net/bacula/bacula-%{version}.tar.gz
101 Source1: http://www.prdownloads.sourceforge.net/bacula/depkgs-qt-%{depkgs_qt_version}.tar.gz
103 BuildRequires: gcc, gcc-c++, make, autoconf
104 BuildRequires: libstdc++-devel = %{gccver}-%{gccrel}, zlib-devel
105 BuildRequires: openssl-devel, fontconfig-devel, libpng-devel, libstdc++-devel, zlib-devel
113 Requires: bacula-libs
116 Requires: /usr/bin/kdesu
118 BuildRequires: freetype2-devel
122 BuildRequires: freetype-devel
125 # Source directory locations
126 %define depkgs_qt ../depkgs-qt
128 # define the basic package description
129 %define blurb Bacula - It comes by night and sucks the vital essence from your computers.
130 %define blurb2 Bacula is a set of computer programs that permit you (or the system
131 %define blurb3 administrator) to manage backup, recovery, and verification of computer
132 %define blurb4 data across a network of computers of different kinds. In technical terms,
133 %define blurb5 it is a network client/server based backup program. Bacula is relatively
134 %define blurb6 easy to use and efficient, while offering many advanced storage management
135 %define blurb7 features that make it easy to find and recover lost or damaged files.
136 %define blurb8 Bacula source code has been released under the GPL version 2 license.
138 Summary: Bacula - The Network Backup Solution
139 Group: System Environment/Daemons
152 This is the Bacula Administration Tool (bat) graphical user interface package.
153 It is an add-on to the client or server packages.
156 %setup -T -n bacula-%{_version} -b 0
157 %setup -T -D -n bacula-%{_version} -b 1
163 #export QTDIR=$(pkg-config --variable=prefix QtCore)
164 #export QTINC=$(pkg-config --variable=includedir QtCore)
165 #export QTLIB=$(pkg-config --variable=libdir QtCore)
166 #export PATH=${QTDIR}/bin/:${PATH}
172 export PATH=${qtdir}/qt4/bin:$PATH
173 export QTDIR=${qtdir}/qt4/
174 export QTINC=${qtdir}/qt4/include/
175 export QTLIB=${qtdir}/qt4/lib/
176 export QMAKESPEC=${qtdir}/qt-x11-opensource-src-%{qt4ver}/mkspecs/linux-g++/
179 # Main Bacula configuration with bat
181 --prefix=%{_prefix} \
182 --sbindir=%{_sbindir} \
183 --sysconfdir=%{sysconf_dir} \
184 --mandir=%{_mandir} \
185 --with-scriptdir=%{script_dir} \
186 --with-working-dir=%{working_dir} \
187 --with-plugindir=%{script_dir} \
188 --with-pid-dir=%{pid_dir} \
189 --with-subsys-dir=%{_subsysdir} \
190 --enable-smartalloc \
193 --enable-client-only \
194 --with-dir-user=%{director_daemon_user} \
195 --with-dir-group=%{daemon_group} \
196 --with-sd-user=%{storage_daemon_user} \
197 --with-sd-group=%{storage_daemon_group} \
198 --with-fd-user=%{file_daemon_user} \
199 --with-fd-group=%{daemon_group} \
200 --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
201 --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
202 --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
203 --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
204 --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
205 --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
211 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
212 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
214 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
215 mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
216 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
217 mkdir -p $RPM_BUILD_ROOT/usr/bin
221 make DESTDIR=$RPM_BUILD_ROOT install
224 rm -rf $RPM_BUILD_ROOT%{_prefix}/share/doc/bacula
227 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
228 cp -p scripts/bat.desktop.xsu $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
229 touch $RPM_BUILD_ROOT%{sysconf_dir}/bat.kdesu
231 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
232 cp -p scripts/bat.desktop.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
233 cp -p scripts/bat.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/bat
234 cp -p scripts/bat.pamd $RPM_BUILD_ROOT/etc/pam.d/bat
235 ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/bat
239 %defattr(-,root,root)
240 %attr(-, root, %{daemon_group}) %{_sbindir}/bat
241 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
242 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bat.conf
243 /usr/share/pixmaps/bat_icon.png
244 /usr/share/applications/bat.desktop
246 # if user is a member of daemon_group then kdesu will run bat as user
248 %attr(0660, root, %{daemon_group}) %{sysconf_dir}/bat.kdesu
252 # add the console helper files
253 %config(noreplace,missingok) /etc/pam.d/bat
254 %config(noreplace,missingok) /etc/security/console.apps/bat
259 # create the daemon group
260 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
261 if [ -z "$HAVE_BACULA" ]; then
262 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
263 echo "The group %{daemon_group} has been added to %{group_file}."
264 echo "See the manual chapter \"Running Bacula\" for details."
269 if [ -d %{sysconf_dir} ]; then
271 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
272 pass=`openssl rand -base64 33`
273 for file in *.conf; do
274 need_password=`grep ${string} $file 2>/dev/null`
275 if [ -n "$need_password" ]; then
276 sed "s@${string}@${pass}@g" $file > $file.new
277 cp -f $file.new $file; rm -f $file.new
281 # put actual hostname in conf file
283 string="XXX_HOSTNAME_XXX"
284 for file in *.conf; do
285 need_host=`grep ${string} $file 2>/dev/null`
286 if [ -n "$need_host" ]; then
287 sed "s@${string}@${host}@g" $file >$file.new
288 cp -f $file.new $file; rm -f $file.new
295 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
296 rm -rf $RPM_BUILD_DIR/depkgs-qt
299 * Sun Mar 14 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
300 - Fix for QT mkspecs location on FC12
301 * Sat Feb 27 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
302 - add dependency on bacula-libs
303 * Sat Feb 13 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
304 - create file to allow bat to run nonroot with kdesu
305 - add dependency information
306 * Sat Jan 30 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
307 - fix consolehelper/xsu for suse packages
308 * Sat Aug 1 2009 Kern Sibbald <kern@sibbald.com>
309 - Split bat into separate bacula-bat.spec