]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula-bat.spec
Merge branch 'master' into bat_slot
[bacula/bacula] / bacula / platforms / redhat / 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           3.0.2
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 Summary: Bacula - The Network Backup Solution
59 Name: bacula-bat
60 Version: %{_version}
61 Release: %{_release}
62 Group: System Environment/Daemons
63 License: GPL v2
64 BuildRoot: %{_tmppath}/%{name}-root
65 URL: http://www.bacula.org/
66 Vendor: The Bacula Team
67 Packager: %{_packager}
68 Prefix: %{_prefix}
69 Distribution: Bacula Bat
70
71 Source0: http://www.prdownloads.sourceforge.net/bacula/bacula-%{version}.tar.gz
72 Source1: http://www.prdownloads.sourceforge.net/bacula/depkgs-qt-%{depkgs_qt_version}.tar.gz
73
74
75 # Source directory locations
76 %define depkgs_qt ../depkgs-qt
77
78 # define the basic package description
79 %define blurb Bacula - It comes by night and sucks the vital essence from your computers.
80 %define blurb2 Bacula is a set of computer programs that permit you (or the system
81 %define blurb3 administrator) to manage backup, recovery, and verification of computer
82 %define blurb4 data across a network of computers of different kinds. In technical terms,
83 %define blurb5 it is a network client/server based backup program. Bacula is relatively
84 %define blurb6 easy to use and efficient, while offering many advanced storage management
85 %define blurb7 features that make it easy to find and recover lost or damaged files.
86 %define blurb8 Bacula source code has been released under the GPL version 2 license.
87
88 Summary: Bacula - The Network Backup Solution
89 Group: System Environment/Daemons
90
91 %description
92 %{blurb}
93
94 %{blurb2}
95 %{blurb3}
96 %{blurb4}
97 %{blurb5}
98 %{blurb6}
99 %{blurb7}
100 %{blurb8}
101
102 This is the Bacula Administration Tool (bat) graphical user interface package.
103 It is an add-on to the client or server packages.
104
105 %prep
106 %setup -T -n bacula-%{_version} -b 0
107 %setup -T -D -n bacula-%{_version} -b 1
108
109 %build
110
111
112 cwd=${PWD}
113 #export QTDIR=$(pkg-config --variable=prefix QtCore)
114 #export QTINC=$(pkg-config --variable=includedir QtCore)
115 #export QTLIB=$(pkg-config --variable=libdir QtCore)
116 #export PATH=${QTDIR}/bin/:${PATH}
117 cd %{depkgs_qt}
118 make qt4 <<EOF
119 yes
120 EOF
121 qtdir=${PWD}
122 export PATH=${qtdir}/qt4/bin:$PATH
123 export QTDIR=${qtdir}/qt4/
124 export QTINC=${qtdir}/qt4/include/
125 export QTLIB=${qtdir}/qt4/lib/
126 cd ${cwd}
127
128 # Main Bacula configuration with bat
129 %configure \
130         --prefix=%{_prefix} \
131         --sbindir=%{_sbindir} \
132         --sysconfdir=%{sysconf_dir} \
133         --mandir=%{_mandir} \
134         --with-scriptdir=%{script_dir} \
135         --with-working-dir=%{working_dir} \
136         --with-plugindir=%{script_dir} \
137         --with-pid-dir=%{pid_dir} \
138         --with-subsys-dir=%{_subsysdir} \
139         --enable-smartalloc \
140         --enable-bat \
141         --without-qwt \
142         --enable-client-only \
143         --with-dir-user=%{director_daemon_user} \
144         --with-dir-group=%{daemon_group} \
145         --with-sd-user=%{storage_daemon_user} \
146         --with-sd-group=%{storage_daemon_group} \
147         --with-fd-user=%{file_daemon_user} \
148         --with-fd-group=%{daemon_group} \
149         --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \
150         --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \
151         --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \
152         --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \
153         --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \
154         --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \
155         --with-openssl
156
157 make
158
159 %install
160 mkdir -p $RPM_BUILD_ROOT/usr/share/applications
161 mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps
162 mkdir -p $RPM_BUILD_ROOT/etc/pam.d
163 mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps
164 mkdir -p $RPM_BUILD_ROOT%{_sbindir}
165
166 cd src/qt-console
167 make DESTDIR=$RPM_BUILD_ROOT install
168 cd ../..
169
170 cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png
171 cp -p scripts/bat.desktop.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bat.desktop
172 cp -p scripts/bat.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/bat
173 cp -p scripts/bat.pamd $RPM_BUILD_ROOT/etc/pam.d/bat
174 ln -sf consolehelper $RPM_BUILD_ROOT/%{_sbindir}/bat
175
176 %files
177 %defattr(-,root,root)
178 %{_sbindir}/bat
179 %attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
180 %attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bat.conf
181 /usr/share/pixmaps/bat_icon.png
182 /usr/share/applications/bat.desktop
183 /usr/share/doc/bacula/*
184 #%{_mandir}/man1/bat.1.%{manpage_ext}
185
186 # add the console helper files
187 %config(noreplace,missingok) /etc/pam.d/bat
188 %config(noreplace,missingok) /etc/security/console.apps/bat
189
190 %pre
191 # create the daemon group
192 HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null`
193 if [ -z "$HAVE_BACULA" ]; then
194     %{groupadd} -r %{daemon_group} > /dev/null 2>&1
195     echo "The group %{daemon_group} has been added to %{group_file}."
196     echo "See the manual chapter \"Running Bacula\" for details."
197 fi
198
199
200 %post
201 if [ -d %{sysconf_dir} ]; then
202    cd %{sysconf_dir}
203    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
204       pass=`openssl rand -base64 33`
205       for file in *.conf; do
206          need_password=`grep ${string} $file 2>/dev/null`
207          if [ -n "$need_password" ]; then
208             sed "s@${string}@${pass}@g" $file > $file.new
209             cp -f $file.new $file; rm -f $file.new
210          fi
211       done
212    done
213 # put actual hostname in conf file
214    host=`hostname`
215    string="XXX_HOSTNAME_XXX"
216    for file in *.conf; do
217       need_host=`grep ${string} $file 2>/dev/null`
218       if [ -n "$need_host" ]; then
219          sed "s@${string}@${host}@g" $file >$file.new
220          cp -f $file.new $file; rm -f $file.new
221       fi
222    done
223 fi
224 /sbin/ldconfig
225
226 %clean
227 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT"
228 rm -rf $RPM_BUILD_DIR/depkgs-qt
229
230 %changelog
231 * Sat Aug 1 2009 Kern Sibbald <kern@sibbald.com>
232 - Split bat into separate bacula-bat.spec