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