1# 2# Bacula RPM spec file 3# 4# Copyright (C) 2000-2020 Kern Sibbald 5# License: BSD 2-Clause; see file LICENSE-FOSS 6# 7 8# Platform Build Configuration 9 10# basic defines for every build 11%define _release @RELEASE@ 12%define _version @VERSION@ 13%define depkgs_qt_version @DEPKGS_QT_VERSION@ 14%define product bacula 15 16# Don't strip binaries 17%define __os_install_post %{nil} 18%define __debug_install_post %{nil} 19%define debug_package %{nil} 20 21# this is the Qt version in depkgs_qt 22%define qt4ver @BQT_VERSION@ 23 24%define _packager Kern Sibbald <kern@sibbald.com> 25 26%define manpage_ext gz 27 28# Force single file build 29%define single_dir 1 30%{?single_dir_install:%define single_dir 1} 31 32# Installation Directory locations 33%if %{single_dir} 34%define _prefix /opt/bacula 35%define _sbindir /opt/bacula/bin 36%define _bindir /opt/bacula/bin 37%define _subsysdir /opt/bacula/working 38%define sqlite_bindir /opt/bacula/sqlite 39%define _mandir /usr/share/man 40%define docs_dir /opt/bacula/docs 41%define archive_dir /opt/bacula/archive 42%define sysconf_dir /opt/bacula/etc 43%define script_dir /opt/bacula/scripts 44%define working_dir /opt/bacula/working 45%define pid_dir /opt/bacula/working 46%define plugin_dir /opt/bacula/plugins 47%define lib_dir /opt/bacula/lib 48%else 49%define _prefix /usr 50%define _sbindir %_prefix/sbin 51%define _bindir %_prefix/bin 52%define _subsysdir /var/lock/subsys 53%define sqlite_bindir %_libdir/bacula/sqlite 54%define _mandir %_prefix/share/man 55%define sysconf_dir /etc/bacula 56%define script_dir %_libdir/bacula 57%define working_dir /var/lib/bacula 58%define pid_dir /var/run 59%define plugin_dir %_libdir/bacula/plugins 60%define lib_dir %_libdir/bacula/lib 61%endif 62 63# Daemon user:group Don't change them unless you know what you are doing 64%define director_daemon_user bacula 65%define daemon_group bacula 66 67#-------------------------------------------------------------------------- 68# it should not be necessary to change anything below here for a release 69# except for patch macros in the setup section 70#-------------------------------------------------------------------------- 71 72%{?contrib_packager:%define _packager %{contrib_packager}} 73 74%{expand: %%define gccver %(rpm -q --queryformat %%{version} gcc)} 75%{expand: %%define gccrel %(rpm -q --queryformat %%{release} gcc)} 76 77%define staticqt 1 78%{?nobuild_staticqt:%define staticqt 0} 79 80# determine what platform we are building on 81%define fedora 0 82%define suse 0 83%define mdk 0 84 85%if %{_vendor} == redhat 86 %define fedora 1 87 %define _dist %(cat /etc/redhat-release) 88%endif 89%if %{_vendor} == suse 90 %define suse 1 91 %define _dist %(grep -i SuSE /etc/SuSE-release) 92%endif 93%if %{_vendor} == Mandriva 94 %define mdk 1 95 %define _dist %(grep Mand /etc/mandrake-release) 96%endif 97%if ! %{fedora} && ! %{suse} && ! %{mdk} 98%{error: Unknown platform. Please examine the spec file.} 99exit 1 100%endif 101 102%define sqlite 0 103%{?build_sqlite:%define sqlite 1} 104 105%define base_package_name bacula 106 107Summary: Bacula - The Network Backup Solution 108Name: %{base_package_name}-bat 109Version: %{_version} 110Release: %{_release} 111Group: System Environment/Daemons 112License: AGPLv3 113BuildRoot: %{_tmppath}/%{name}-root 114URL: http://www.bacula.org/ 115Vendor: The Bacula Team 116Packager: %{_packager} 117Prefix: %{_prefix} 118Distribution: %{_dist} 119 120Source0: http://www.prdownloads.sourceforge.net/bacula/%{product}-%{version}.tar.gz 121Source1: http://www.prdownloads.sourceforge.net/bacula/depkgs-qt-%{depkgs_qt_version}.tar.gz 122 123BuildRequires: gcc, gcc-c++, make, autoconf 124BuildRequires: libstdc++-devel, zlib-devel 125BuildRequires: openssl-devel, fontconfig-devel, libpng-devel, libstdc++-devel, zlib-devel 126 127Requires: openssl 128Requires: fontconfig 129Requires: libpng 130%if 0%{?suse_version} > 1210 131Requires: libstdc++.6 132%else 133Requires: libstdc++ 134%endif 135Requires: zlib 136Requires: %{base_package_name}-libs 137 138%if %{suse} 139Requires: freetype2 140BuildRequires: freetype2-devel 141%else 142Requires: usermode 143Requires: freetype 144BuildRequires: freetype-devel 145%endif 146 147# Source directory locations 148%define depkgs_qt ../depkgs-qt 149 150# define the basic package description 151%define blurb Bacula - The Network Backup Solution. 152%define blurb2 Bacula is a set of computer programs that permit you (or the system 153%define blurb3 administrator) to manage backup, recovery, and verification of computer 154%define blurb4 data across a network of computers of different kinds. In technical terms, 155%define blurb5 it is a network client/server based backup program. Bacula is relatively 156%define blurb6 easy to use and efficient, while offering many advanced storage management 157%define blurb7 features that make it easy to find and recover lost or damaged files. 158 159%define group_file /etc/group 160%define groupadd /usr/sbin/groupadd 161 162Summary: Bacula - The Network Backup Solution 163Group: System Environment/Daemons 164 165%description 166%{blurb} 167 168%{blurb2} 169%{blurb3} 170%{blurb4} 171%{blurb5} 172%{blurb6} 173%{blurb7} 174 175This is the Bacula Administration Tool (bat) graphical user interface package. 176It is an add-on to the client or server packages. 177 178# Don't strip symbols 179%define debug_package %{nil} 180 181# Must explicitly enable debug pkg on SuSE 182# but not in opensuse_bs 183#%if %{suse} && ! 0%{?opensuse_bs} 184#%debug_package 185#%endif 186 187%prep 188%setup -T -n %{product}-%{_version} -b 0 189%setup -T -D -n %{product}-%{_version} -b 1 190 191%build 192 193 194cwd=${PWD} 195%if ! %{staticqt} 196export QTDIR=$(pkg-config --variable=prefix QtCore) 197export QTINC=$(pkg-config --variable=includedir QtCore) 198export QTLIB=$(pkg-config --variable=libdir QtCore) 199export PATH=${QTDIR}/bin/:${PATH} 200%else 201# You can use a cache for depkgs-qt 202# tar xfz depkgs-qt*gz -C ~/ 203# cd ~/depkgs-qt 204# echo yes | make qt4 205# touch %{depkgs_qt_version} # depkgs version 206if [ -f $HOME/depkgs-qt/%{depkgs_qt_version} ]; then 207 rm -rf %{depkgs_qt} 208 ln -s $HOME/depkgs-qt %{depkgs_qt} 209 cd %{depkgs_qt} 210else 211 cd %{depkgs_qt} 212 make qt4 <<EOF 213yes 214EOF 215fi 216 217source ./qt4-paths 218rm -f ${QTLIB}/QtCore.so* ${QTLIB}/QtGUI.so* 219cd ${cwd} 220 221%endif 222 223# hostname is the build hostname, so use XXX_HOSTNAME_XXX for Address parameter 224sed -i s/hostname/basename/ src/console/bconsole.conf.in src/dird/bacula-dir.conf.in src/qt-console/bat.conf.in 225 226# Main Bacula configuration with bat 227%configure \ 228 --prefix=%{_prefix} \ 229 --sbindir=%{_sbindir} \ 230 --sysconfdir=%{sysconf_dir} \ 231 --mandir=%{_mandir} \ 232 --docdir=%{docs_dir} \ 233 --with-archivedir=%{archive_dir} \ 234 --with-scriptdir=%{script_dir} \ 235 --with-working-dir=%{working_dir} \ 236 --with-plugindir=%{script_dir} \ 237 --with-pid-dir=%{pid_dir} \ 238 --with-subsys-dir=%{_subsysdir} \ 239 --enable-smartalloc \ 240 --enable-bat \ 241 --enable-client-only \ 242 --with-dir-user=%{director_daemon_user} \ 243 --with-dir-group=%{daemon_group} \ 244 --with-sd-user=%{storage_daemon_user} \ 245 --with-sd-group=%{storage_daemon_group} \ 246 --with-fd-user=%{file_daemon_user} \ 247 --with-fd-group=%{daemon_group} \ 248 --with-basename="XXX_HOSTNAME_XXX" \ 249 --with-hostname="XXX_HOSTNAME_XXX" \ 250 --with-dir-password="XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX" \ 251 --with-fd-password="XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX" \ 252 --with-sd-password="XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX" \ 253 --with-mon-dir-password="XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX" \ 254 --with-mon-fd-password="XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX" \ 255 --with-mon-sd-password="XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX" \ 256 --with-openssl 257 258make 259 260%install 261mkdir -p $RPM_BUILD_ROOT/usr/share/applications 262mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps 263%if ! %{suse} 264mkdir -p $RPM_BUILD_ROOT/etc/pam.d 265mkdir -p $RPM_BUILD_ROOT/etc/security/console.apps 266mkdir -p $RPM_BUILD_ROOT%{_sbindir} 267mkdir -p $RPM_BUILD_ROOT/usr/bin 268%endif 269 270cd src/qt-console 271make DESTDIR=$RPM_BUILD_ROOT install 272cd ../.. 273 274rm -rf $RPM_BUILD_ROOT%{_prefix}/share/doc/bacula 275 276%if %{suse} 277cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png 278cp -p scripts/bat.desktop.xsu $RPM_BUILD_ROOT/usr/share/applications/bat.desktop 279touch $RPM_BUILD_ROOT%{sysconf_dir}/bat.kdesu 280%else 281cp -p src/qt-console/images/bat_icon.png $RPM_BUILD_ROOT/usr/share/pixmaps/bat_icon.png 282cp -p scripts/bat.desktop.consolehelper $RPM_BUILD_ROOT/usr/share/applications/bat.desktop 283cp -p scripts/bat.console_apps $RPM_BUILD_ROOT/etc/security/console.apps/bat 284cp -p scripts/bat.pamd $RPM_BUILD_ROOT/etc/pam.d/bat 285ln -sf consolehelper $RPM_BUILD_ROOT/usr/bin/bat 286%endif 287 288%files 289%defattr(-,root,root) 290%attr(-, root, %{daemon_group}) %{_sbindir}/bat 291%attr(770, root, %{daemon_group}) %dir %{sysconf_dir} 292%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bat.conf 293%attr(-, root, %{daemon_group}) %{docs_dir}/*.html 294%attr(-, root, %{daemon_group}) %{docs_dir}/*.png 295/usr/share/pixmaps/bat_icon.png 296/usr/share/applications/bat.desktop 297 298# if user is a member of daemon_group then kdesu will run bat as user 299%if %{suse} 300%attr(0660, root, %{daemon_group}) %{sysconf_dir}/bat.kdesu 301%endif 302 303%if ! %{suse} 304# add the console helper files 305%config(noreplace,missingok) /etc/pam.d/bat 306%config(noreplace,missingok) /etc/security/console.apps/bat 307/usr/bin/bat 308%endif 309 310 311 312%pre 313# create the daemon group 314HAVE_BACULA=`grep %{daemon_group} %{group_file} 2>/dev/null` 315if [ -z "$HAVE_BACULA" ]; then 316 %{groupadd} -r %{daemon_group} > /dev/null 2>&1 317 echo "The group %{daemon_group} has been added to %{group_file}." 318 echo "See the manual chapter \"Running Bacula\" for details." 319fi 320 321 322%post 323if [ -d %{sysconf_dir} ]; then 324 cd %{sysconf_dir} 325 if [ ! -f .rpm.sed ]; then 326 (umask 0177 327 echo "# This file is used to ensure that all passwords will" > .rpm.sed 328 echo "# match between configuration files" >> .rpm.sed 329 ) 330 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 331 pass=`openssl rand -base64 33` 332 echo "s@${string}@${pass}@g" >> .rpm.sed 333 done 334 fi 335 host=`hostname -s` 336 for file in *.conf; do 337 sed -f .rpm.sed $file > $file.new 338 sed "s@XXX_HOSTNAME_XXX@${host}@g" $file.new > $file 339 rm -f $file.new 340 done 341fi 342/sbin/ldconfig 343 344%clean 345[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "$RPM_BUILD_ROOT" 346rm -rf $RPM_BUILD_DIR/depkgs-qt 347 348%changelog 349* Sat Aug 1 2009 Kern Sibbald <kern@sibbald.com> 350- Split bat into separate bacula-bat.spec 351