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
11 %define _packager D. Scott Barninger <barninger@fairfieldcomputers.com>
13 %define manpage_ext gz
16 %{?single_dir_install:%define single_dir 1}
18 # Installation Directory locations
20 %define _prefix /opt/bacula
21 %define _sbindir /opt/bacula/bin
22 %define _bindir /opt/bacula/bin
23 %define _subsysdir /opt/bacula/working
24 %define sqlite_bindir /opt/bacula/sqlite
25 %define _mandir /usr/share/man
26 %define sysconf_dir /opt/bacula/etc
27 %define script_dir /opt/bacula/scripts
28 %define working_dir /opt/bacula/working
29 %define pid_dir /opt/bacula/working
30 %define plugin_dir /opt/bacula/plugins
31 %define lib_dir /opt/bacula/lib
34 %define _sbindir %_prefix/sbin
35 %define _bindir %_prefix/bin
36 %define _subsysdir /var/lock/subsys
37 %define sqlite_bindir %_libdir/bacula/sqlite
38 %define _mandir %_prefix/share/man
39 %define sysconf_dir /etc/bacula
40 %define script_dir %_libdir/bacula
41 %define working_dir /var/lib/bacula
42 %define pid_dir /var/run
43 %define plugin_dir %_libdir/bacula/plugins
44 %define lib_dir %_libdir/bacula/lib
47 # Daemon user:group Don't change them unless you know what you are doing
48 %define director_daemon_user bacula
49 %define daemon_group bacula
51 #--------------------------------------------------------------------------
52 # it should not be necessary to change anything below here for a release
53 # except for patch macros in the setup section
54 #--------------------------------------------------------------------------
56 %{?contrib_packager:%define _packager %{contrib_packager}}
58 # determine what platform we are building on
63 %if %{_vendor} == redhat
65 %define _dist %(cat /etc/redhat-release)
67 %if %{_vendor} == suse
69 %define _dist %(grep -i SuSE /etc/SuSE-release)
71 %if %{_vendor} == Mandriva
73 %define _dist %(grep Mand /etc/mandrake-release)
75 %if ! %{fedora} && ! %{suse} && ! %{mdk}
76 %{error: Unknown platform. Please examine the spec file.}
80 Summary: Bacula - The Network Backup Solution
84 Group: System Environment/Daemons
86 BuildRoot: %{_tmppath}/%{name}-root
87 URL: http://www.bacula.org/
88 Vendor: The Bacula Team
89 Packager: %{_packager}
91 Distribution: %{_dist}
93 Source0: http://www.prdownloads.sourceforge.net/bacula/bacula-%{version}.tar.gz
94 Source1: http://www.prdownloads.sourceforge.net/bacula/depkgs-qt-%{depkgs_qt_version}.tar.gz
97 # Source directory locations
98 %define depkgs_qt ../depkgs-qt
100 # define the basic package description
101 %define blurb Bacula - It comes by night and sucks the vital essence from your computers.
102 %define blurb2 Bacula is a set of computer programs that permit you (or the system
103 %define blurb3 administrator) to manage backup, recovery, and verification of computer
104 %define blurb4 data across a network of computers of different kinds. In technical terms,
105 %define blurb5 it is a network client/server based backup program. Bacula is relatively
106 %define blurb6 easy to use and efficient, while offering many advanced storage management
107 %define blurb7 features that make it easy to find and recover lost or damaged files.
108 %define blurb8 Bacula source code has been released under the GPL version 2 license.
110 Summary: Bacula - The Network Backup Solution
111 Group: System Environment/Daemons
124 This is the Bacula Administration Tool (bat) graphical user interface package.
125 It is an add-on to the client or server packages.
128 %setup -T -n bacula-%{_version} -b 0
129 %setup -T -D -n bacula-%{_version} -b 1
135 #export QTDIR=$(pkg-config --variable=prefix QtCore)
136 #export QTINC=$(pkg-config --variable=includedir QtCore)
137 #export QTLIB=$(pkg-config --variable=libdir QtCore)
138 #export PATH=${QTDIR}/bin/:${PATH}
144 export PATH=${qtdir}/qt4/bin:$PATH
145 export QTDIR=${qtdir}/qt4/
146 export QTINC=${qtdir}/qt4/include/
147 export QTLIB=${qtdir}/qt4/lib/
150 # Main Bacula configuration with bat
152 --prefix=%{_prefix} \
153 --sbindir=%{_sbindir} \
154 --sysconfdir=%{sysconf_dir} \
155 --mandir=%{_mandir} \
156 --with-scriptdir=%{script_dir} \
157 --with-working-dir=%{working_dir} \
158 --with-plugindir=%{script_dir} \
159 --with-pid-dir=%{pid_dir} \
160 --with-subsys-dir=%{_subsysdir} \
161 --enable-smartalloc \
164 --enable-client-only \
165 --with-dir-user=%{director_daemon_user} \
166 --with-dir-group=%{daemon_group} \
167 --with-sd-user=%{storage_daemon_user} \
168 --with-sd-group=%{storage_daemon_group} \
169 --with-fd-user=%{file_daemon_user} \
170 --with-fd-group=%{daemon_group} \
171 --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
172 --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
173 --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
174 --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
175 --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
176 --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
182 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
183 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
185 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
186 mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
187 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
188 mkdir -p $RPM_BUILD_ROOT/usr/bin
192 make DESTDIR=$RPM_BUILD_ROOT install
195 rm -rf $RPM_BUILD_ROOT%{_prefix}/share/doc/bacula
198 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
199 cp -p scripts/bat.desktop.xsu $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
201 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
202 cp -p scripts/bat.desktop.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
203 cp -p scripts/bat.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/bat
204 cp -p scripts/bat.pamd $RPM_BUILD_ROOT/etc/pam.d/bat
205 ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/bat
209 %defattr(-,root,root)
211 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
212 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bat.conf
213 /usr/share/pixmaps/bat_icon.png
214 /usr/share/applications/bat.desktop
217 # add the console helper files
218 %config(noreplace,missingok) /etc/pam.d/bat
219 %config(noreplace,missingok) /etc/security/console.apps/bat
224 # create the daemon group
225 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
226 if [ -z "$HAVE_BACULA" ]; then
227 %{groupadd} -r %{daemon_group} > /dev/null 2>&1
228 echo "The group %{daemon_group} has been added to %{group_file}."
229 echo "See the manual chapter \"Running Bacula\" for details."
234 if [ -d %{sysconf_dir} ]; then
236 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
237 pass=`openssl rand -base64 33`
238 for file in *.conf; do
239 need_password=`grep ${string} $file 2>/dev/null`
240 if [ -n "$need_password" ]; then
241 sed "s@${string}@${pass}@g" $file > $file.new
242 cp -f $file.new $file; rm -f $file.new
246 # put actual hostname in conf file
248 string="XXX_HOSTNAME_XXX"
249 for file in *.conf; do
250 need_host=`grep ${string} $file 2>/dev/null`
251 if [ -n "$need_host" ]; then
252 sed "s@${string}@${host}@g" $file >$file.new
253 cp -f $file.new $file; rm -f $file.new
260 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
261 rm -rf $RPM_BUILD_DIR/depkgs-qt
264 * Sat Jan 30 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
265 - fix consolehelper/xsu for suse packages
266 * Sat Aug 1 2009 Kern Sibbald <kern@sibbald.com>
267 - Split bat into separate bacula-bat.spec