]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/rpm/bacula-bat.spec
Tweak spec files
[bacula/bacula] / bacula / platforms / rpm / bacula-bat.spec
1 # Bacula RPM spec file
2 #
3 # Copyright (C) 2000-2010 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.3
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 %define staticqt 1
66 %{?nobuild_staticqt:%define staticqt 0}
67
68 # determine what platform we are building on
69 %define fedora 0
70 %define suse 0
71 %define mdk 0
72
73 %if %{_vendor} == redhat
74         %define fedora 1
75         %define _dist %(cat /etc/redhat-release)
76 %endif
77 %if %{_vendor} == suse
78         %define suse 1
79         %define _dist %(grep -i SuSE /etc/SuSE-release)
80 %endif
81 %if %{_vendor} == Mandriva
82         %define mdk 1
83         %define _dist %(grep Mand /etc/mandrake-release)
84 %endif
85 %if ! %{fedora} && ! %{suse} && ! %{mdk}
86 %{error: Unknown platform. Please examine the spec file.}
87 exit 1
88 %endif
89
90 Summary: Bacula - The Network Backup Solution
91 Name: bacula-bat
92 Version: %{_version}
93 Release: %{_release}
94 Group: System Environment/Daemons
95 License: AGPLv3
96 BuildRoot: %{_tmppath}/%{name}-root
97 URL: http://www.bacula.org/
98 Vendor: The Bacula Team
99 Packager: %{_packager}
100 Prefix: %{_prefix}
101 Distribution: %{_dist}
102
103 Source0: http://www.prdownloads.sourceforge.net/bacula/bacula-%{version}.tar.gz
104 Source1: http://www.prdownloads.sourceforge.net/bacula/depkgs-qt-%{depkgs_qt_version}.tar.gz
105
106 BuildRequires: gcc, gcc-c++, make, autoconf
107 BuildRequires: libstdc++-devel = %{gccver}-%{gccrel}, zlib-devel
108 BuildRequires: openssl-devel, fontconfig-devel, libpng-devel, libstdc++-devel, zlib-devel
109
110 Requires: openssl
111 Requires: fontconfig
112 Requires: libgcc
113 Requires: libpng
114 Requires: libstdc++
115 Requires: zlib
116 Requires: bacula-libs
117
118 %if %{suse}
119 Requires: /usr/bin/kdesu
120 Requires: freetype2
121 BuildRequires: freetype2-devel
122 %else
123 Requires: usermode
124 Requires: freetype
125 BuildRequires: freetype-devel
126 %endif
127
128 # Source directory locations
129 %define depkgs_qt ../depkgs-qt
130
131 # define the basic package description
132 %define blurb Bacula - The Leading Open Source Backup Solution.
133 %define blurb2 Bacula is a set of computer programs that permit you (or the system
134 %define blurb3 administrator) to manage backup, recovery, and verification of computer
135 %define blurb4 data across a network of computers of different kinds. In technical terms,
136 %define blurb5 it is a network client/server based backup program. Bacula is relatively
137 %define blurb6 easy to use and efficient, while offering many advanced storage management
138 %define blurb7 features that make it easy to find and recover lost or damaged files.
139 %define blurb8 Bacula source code has been released under the AGPL version 3 license.
140
141 Summary: Bacula - The Network Backup Solution
142 Group: System Environment/Daemons
143
144 %description
145 %{blurb}
146
147 %{blurb2}
148 %{blurb3}
149 %{blurb4}
150 %{blurb5}
151 %{blurb6}
152 %{blurb7}
153 %{blurb8}
154
155 This is the Bacula Administration Tool (bat) graphical user interface package.
156 It is an add-on to the client or server packages.
157
158 %prep
159 %setup -T -n bacula-%{_version} -b 0
160 %setup -T -D -n bacula-%{_version} -b 1
161
162 %build
163
164
165 cwd=${PWD}
166 %if ! %{staticqt}
167 export QTDIR=$(pkg-config --variable=prefix QtCore)
168 export QTINC=$(pkg-config --variable=includedir QtCore)
169 export QTLIB=$(pkg-config --variable=libdir QtCore)
170 export PATH=${QTDIR}/bin/:${PATH}
171 %else
172 cd %{depkgs_qt}
173 make qt4 <<EOF
174 yes
175 EOF
176 qtdir=${PWD}
177 export PATH=${qtdir}/qt4/bin:$PATH
178 export QTDIR=${qtdir}/qt4/
179 export QTINC=${qtdir}/qt4/include/
180 export QTLIB=${qtdir}/qt4/lib/
181 export QMAKESPEC=${qtdir}/qt-x11-opensource-src-%{qt4ver}/mkspecs/linux-g++/
182 cd ${cwd}
183 %endif
184
185 # Main Bacula configuration with bat
186 %configure \
187         --prefix=%{_prefix} \
188         --sbindir=%{_sbindir} \
189         --sysconfdir=%{sysconf_dir} \
190         --mandir=%{_mandir} \
191         --with-scriptdir=%{script_dir} \
192         --with-working-dir=%{working_dir} \
193         --with-plugindir=%{script_dir} \
194         --with-pid-dir=%{pid_dir} \
195         --with-subsys-dir=%{_subsysdir} \
196         --enable-smartalloc \
197         --enable-bat \
198         --without-qwt \
199         --enable-client-only \
200         --with-dir-user=%{director_daemon_user} \
201         --with-dir-group=%{daemon_group} \
202         --with-sd-user=%{storage_daemon_user} \
203         --with-sd-group=%{storage_daemon_group} \
204         --with-fd-user=%{file_daemon_user} \
205         --with-fd-group=%{daemon_group} \
206         --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
207         --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
208         --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
209         --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
210         --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
211         --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
212         --with-openssl
213
214 make
215
216 %install
217 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
218 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
219 %if ! %{suse}
220 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
221 mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
222 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
223 mkdir -p $RPM_BUILD_ROOT/usr/bin
224 %endif
225
226 cd src/qt-console
227 make DESTDIR=$RPM_BUILD_ROOT install
228 cd ../..
229
230 rm -rf $RPM_BUILD_ROOT%{_prefix}/share/doc/bacula
231
232 %if %{suse}
233 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
234 cp -p scripts/bat.desktop.xsu $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
235 touch $RPM_BUILD_ROOT%{sysconf_dir}/bat.kdesu
236 %else
237 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
238 cp -p scripts/bat.desktop.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
239 cp -p scripts/bat.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/bat
240 cp -p scripts/bat.pamd $RPM_BUILD_ROOT/etc/pam.d/bat
241 ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/bat
242 %endif
243
244 %files
245 %defattr(-,root,root)
246 %attr(-, root, %{daemon_group}) %{_sbindir}/bat
247 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
248 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bat.conf
249 /usr/share/pixmaps/bat_icon.png
250 /usr/share/applications/bat.desktop
251
252 # if user is a member of daemon_group then kdesu will run bat as user
253 %if %{suse}
254 %attr(0660, root, %{daemon_group}) %{sysconf_dir}/bat.kdesu
255 %endif
256
257 %if ! %{suse}
258 # add the console helper files
259 %config(noreplace,missingok) /etc/pam.d/bat
260 %config(noreplace,missingok) /etc/security/console.apps/bat
261 /usr/bin/bat
262 %endif
263
264 %pre
265 # create the daemon group
266 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
267 if [ -z "$HAVE_BACULA" ]; then
268     %{groupadd} -r %{daemon_group} > /dev/null 2>&1
269     echo "The group %{daemon_group} has been added to %{group_file}."
270     echo "See the manual chapter \"Running Bacula\" for details."
271 fi
272
273
274 %post
275 if [ -d %{sysconf_dir} ]; then
276    cd %{sysconf_dir}
277    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
278       pass=`openssl rand -base64 33`
279       for file in *.conf; do
280          need_password=`grep ${string} $file 2>/dev/null`
281          if [ -n "$need_password" ]; then
282             sed "s@${string}@${pass}@g" $file > $file.new
283             cp -f $file.new $file; rm -f $file.new
284          fi
285       done
286    done
287 # put actual hostname in conf file
288    host=`hostname`
289    string="XXX_HOSTNAME_XXX"
290    for file in *.conf; do
291       need_host=`grep ${string} $file 2>/dev/null`
292       if [ -n "$need_host" ]; then
293          sed "s@${string}@${host}@g" $file >$file.new
294          cp -f $file.new $file; rm -f $file.new
295       fi
296    done
297 fi
298 /sbin/ldconfig
299
300 %clean
301 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
302 rm -rf $RPM_BUILD_DIR/depkgs-qt
303
304 %changelog
305 * Sun Mar 14 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
306 - Fix for QT mkspecs location on FC12
307 - allow user to build without embedded static QT
308 * Sat Feb 27 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
309 - add dependency on bacula-libs
310 * Sat Feb 13 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
311 - create file to allow bat to run nonroot with kdesu
312 - add dependency information
313 * Sat Jan 30 2010 D. Scott Barninger <barninger@fairfieldcomputers.com>
314 - fix consolehelper/xsu for suse packages
315 * Sat Aug 1 2009 Kern Sibbald <kern@sibbald.com>
316 - Split bat into separate bacula-bat.spec