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