]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/rpm/bacula-bat.spec
Fix for qt mkspecs location on Fedora 12.
[bacula/bacula] / bacula / platforms / rpm / bacula-bat.spec
1 # Bacula RPM spec file
2 #
3 # Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
4
5 # Platform Build Configuration
6
7 # basic defines for every build
8 %define _release           1
9 %define _version           5.0.1
10 %define depkgs_qt_version  28Jul09
11
12 # this is the QT version in depkgs_qt
13 %define qt4ver             4.3.4
14
15 %define _packager D. Scott Barninger <barninger@fairfieldcomputers.com>
16
17 %define manpage_ext gz
18
19 %define single_dir 0
20 %{?single_dir_install:%define single_dir 1}
21
22 # Installation Directory locations
23 %if %{single_dir}
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
36 %else
37 %define _prefix        /usr
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
49 %endif
50
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
54
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 #--------------------------------------------------------------------------
59
60 %{?contrib_packager:%define _packager %{contrib_packager}}
61
62 %{expand: %%define gccver %(rpm -q --queryformat %%{version} gcc)}
63 %{expand: %%define gccrel %(rpm -q --queryformat %%{release} gcc)}
64
65 # determine what platform we are building on
66 %define fedora 0
67 %define suse 0
68 %define mdk 0
69
70 %if %{_vendor} == redhat
71         %define fedora 1
72         %define _dist %(cat /etc/redhat-release)
73 %endif
74 %if %{_vendor} == suse
75         %define suse 1
76         %define _dist %(grep -i SuSE /etc/SuSE-release)
77 %endif
78 %if %{_vendor} == Mandriva
79         %define mdk 1
80         %define _dist %(grep Mand /etc/mandrake-release)
81 %endif
82 %if ! %{fedora} && ! %{suse} && ! %{mdk}
83 %{error: Unknown platform. Please examine the spec file.}
84 exit 1
85 %endif
86
87 Summary: Bacula - The Network Backup Solution
88 Name: bacula-bat
89 Version: %{_version}
90 Release: %{_release}
91 Group: System Environment/Daemons
92 License: GPL v2
93 BuildRoot: %{_tmppath}/%{name}-root
94 URL: http://www.bacula.org/
95 Vendor: The Bacula Team
96 Packager: %{_packager}
97 Prefix: %{_prefix}
98 Distribution: %{_dist}
99
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
102
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
106
107 Requires: openssl
108 Requires: fontconfig
109 Requires: libgcc
110 Requires: libpng
111 Requires: libstdc++
112 Requires: zlib
113 Requires: bacula-libs
114
115 %if %{suse}
116 Requires: /usr/bin/kdesu
117 Requires: freetype2
118 BuildRequires: freetype2-devel
119 %else
120 Requires: usermode
121 Requires: freetype
122 BuildRequires: freetype-devel
123 %endif
124
125 # Source directory locations
126 %define depkgs_qt ../depkgs-qt
127
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.
137
138 Summary: Bacula - The Network Backup Solution
139 Group: System Environment/Daemons
140
141 %description
142 %{blurb}
143
144 %{blurb2}
145 %{blurb3}
146 %{blurb4}
147 %{blurb5}
148 %{blurb6}
149 %{blurb7}
150 %{blurb8}
151
152 This is the Bacula Administration Tool (bat) graphical user interface package.
153 It is an add-on to the client or server packages.
154
155 %prep
156 %setup -T -n bacula-%{_version} -b 0
157 %setup -T -D -n bacula-%{_version} -b 1
158
159 %build
160
161
162 cwd=${PWD}
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}
167 cd %{depkgs_qt}
168 make qt4 <<EOF
169 yes
170 EOF
171 qtdir=${PWD}
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++/
177 cd ${cwd}
178
179 # Main Bacula configuration with bat
180 %configure \
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 \
191         --enable-bat \
192         --without-qwt \
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" \
206         --with-openssl
207
208 make
209
210 %install
211 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
212 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
213 %if ! %{suse}
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
218 %endif
219
220 cd src/qt-console
221 make DESTDIR=$RPM_BUILD_ROOT install
222 cd ../..
223
224 rm -rf $RPM_BUILD_ROOT%{_prefix}/share/doc/bacula
225
226 %if %{suse}
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
230 %else
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
236 %endif
237
238 %files
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
245
246 # if user is a member of daemon_group then kdesu will run bat as user
247 %if %{suse}
248 %attr(0660, root, %{daemon_group}) %{sysconf_dir}/bat.kdesu
249 %endif
250
251 %if ! %{suse}
252 # add the console helper files
253 %config(noreplace,missingok) /etc/pam.d/bat
254 %config(noreplace,missingok) /etc/security/console.apps/bat
255 /usr/bin/bat
256 %endif
257
258 %pre
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."
265 fi
266
267
268 %post
269 if [ -d %{sysconf_dir} ]; then
270    cd %{sysconf_dir}
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
278          fi
279       done
280    done
281 # put actual hostname in conf file
282    host=`hostname`
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
289       fi
290    done
291 fi
292 /sbin/ldconfig
293
294 %clean
295 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
296 rm -rf $RPM_BUILD_DIR/depkgs-qt
297
298 %changelog
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