# directory locations
%define sqlite_bindir /usr/lib/bacula/sqlite
-%define working_dir /var/bacula
%define _docsrc ../%{name}-docs-%{docs_version}
%define _rescuesrc ../%{name}-rescue-%{_rescuever}
%define depkgs ../depkgs
%define _mandir /usr/share/man
+# directory locations for FHS-compatibility
+%define sysconf_dir /etc/bacula
+%define script_dir /etc/bacula
+%define working_dir /var/lib/bacula
+%define pid_dir /var/run
+
# NOTE these defines are used in some rather complex useradd and groupadd
# commands. If you change them examine the post scripts for consequences.
%define director_daemon_user bacula
%define centos4 0
%{?build_centos4:%define centos4 1}
%{?build_centos4:%define fc3 1}
+# SL build
+%define sl3 0
+%{?build_sl3:%define sl3 1}
+%{?build_sl3:%define wb3 1}
+%define sl4 0
+%{?build_sl4:%define sl4 1}
+%{?build_sl4:%define fc3 1}
# SuSE build
%define su9 0
%{?build_su9:%define su9 1}
%if %{centos4} || %{centos3}
%define _dist %(grep CentOS /etc/redhat-release)
%endif
-%if %{fc3} && ! %{rhel4} && ! %{centos4}
+%if %{sl4} || %{sl3}
+%define _dist %(grep 'Scientific Linux' /etc/redhat-release)
+%endif
+%if %{fc3} && ! %{rhel4} && ! %{centos4} && ! %{sl4}
%define _dist %(grep Fedora /etc/redhat-release)
%endif
-%if %{wb3} && ! %{rhel3} && ! %{centos3}
+%if %{wb3} && ! %{rhel3} && ! %{centos3} && ! %{sl3}
%define _dist %(grep White /etc/whitebox-release)
%endif
%if %{su9} || %{su10} || %{su102}
%configure \
--prefix=/usr \
--sbindir=/usr/sbin \
- --sysconfdir=/etc/bacula \
- --with-scriptdir=/etc/bacula \
+ --sysconfdir=%{sysconf_dir} \
+ --with-scriptdir=%{script_dir} \
+ --with-working-dir=%{working_dir} \
+ --with-pid-dir=%{pid_dir} \
--enable-smartalloc \
--enable-client-only \
%if %{mdk}
%configure \
--prefix=/usr \
--sbindir=/usr/sbin \
- --sysconfdir=/etc/bacula \
- --with-scriptdir=/etc/bacula \
+ --sysconfdir=%{sysconf_dir} \
+ --with-scriptdir=%{script_dir} \
+ --with-working-dir=%{working_dir} \
+ --with-pid-dir=%{pid_dir} \
--enable-smartalloc \
%if %{gconsole}
--enable-gnome \
--enable-client-only \
%endif
--mandir=%{_mandir} \
- --with-working-dir=%{working_dir} \
- --with-pid-dir=/var/run \
--with-subsys-dir=/var/lock/subsys \
--with-dir-user=%{director_daemon_user} \
--with-dir-group=%{daemon_group} \
mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/logfiles
mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/services
mkdir -p $RPM_BUILD_ROOT/etc/log.d/scripts/services
-mkdir -p $RPM_BUILD_ROOT/etc/bacula/updatedb
+mkdir -p $RPM_BUILD_ROOT%{script_dir}/updatedb
%if %{gconsole} || %{wxconsole}
mkdir -p $RPM_BUILD_ROOT/usr/share/applications
make \
prefix=$RPM_BUILD_ROOT/usr \
sbindir=$RPM_BUILD_ROOT/usr/sbin \
- sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
- scriptdir=$RPM_BUILD_ROOT/etc/bacula \
+ sysconfdir=$RPM_BUILD_ROOT%{sysconf_dir} \
+ scriptdir=$RPM_BUILD_ROOT%{script_dir} \
working_dir=$RPM_BUILD_ROOT%{working_dir} \
+ piddir=$RPM_BUILD_ROOT%{pid_dir} \
mandir=$RPM_BUILD_ROOT%{_mandir} \
install
make \
prefix=$RPM_BUILD_ROOT/usr \
sbindir=$RPM_BUILD_ROOT/usr/sbin \
- sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
+ sysconfdir=$RPM_BUILD_ROOT%{sysconf_dir} \
+ scriptdir=$RPM_BUILD_ROOT%{script_dir} \
working_dir=$RPM_BUILD_ROOT%{working_dir} \
+ piddir=$RPM_BUILD_ROOT%{pid_dir} \
mandir=$RPM_BUILD_ROOT%{_mandir} \
mtx-install
cd ${cwd}
# fixme - make installs the mysql scripts for sqlite build
%if %{sqlite}
-rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
+rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/grant_mysql_privileges
%endif
# fixme - make installs the mysql scripts for postgresql build
%if %{postgresql}
-rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
%endif
# fixme - make installs gconsole script for build without gconsole
%if ! %{gconsole}
-rm -f $RPM_BUILD_ROOT/etc/bacula/gconsole
+rm -f $RPM_BUILD_ROOT%{script_dir}/gconsole
%endif
rm -f $RPM_BUILD_ROOT/usr/sbin/static-bacula-fd
cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
# install the updatedb scripts
-cp -p updatedb/* $RPM_BUILD_ROOT/etc/bacula/updatedb/
+cp -p updatedb/* $RPM_BUILD_ROOT%{script_dir}/updatedb/
# install the logwatch scripts
%if ! %{client_only}
%endif
# install the rescue files
-mkdir $RPM_BUILD_ROOT/etc/bacula/rescue
-cp -p %{_rescuesrc}/Makefile* $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -p %{_rescuesrc}/README $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -p %{_rescuesrc}/configure $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -p %{_rescuesrc}/version.h $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -pr %{_rescuesrc}/linux $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -pr %{_rescuesrc}/autoconf $RPM_BUILD_ROOT/etc/bacula/rescue/
-touch $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/rpm_release
-cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/bacula/bin/bacula-fd
+mkdir $RPM_BUILD_ROOT%{sysconf_dir}/rescue
+cp -p %{_rescuesrc}/Makefile* $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -p %{_rescuesrc}/README $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -p %{_rescuesrc}/configure $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -p %{_rescuesrc}/version.h $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -pr %{_rescuesrc}/linux $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -pr %{_rescuesrc}/autoconf $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+touch $RPM_BUILD_ROOT%{sysconf_dir}/rescue/linux/cdrom/rpm_release
+cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT%{sysconf_dir}/rescue/linux/cdrom/bacula/bin/bacula-fd
rm -f src/filed/static-bacula-fd
%if %{wxconsole}
mv $RPM_BUILD_ROOT/usr/sbin/wx-console $RPM_BUILD_ROOT/usr/sbin/wxconsole
-mv $RPM_BUILD_ROOT/etc/bacula/wx-console.conf $RPM_BUILD_ROOT/etc/bacula/wxconsole.conf
+mv $RPM_BUILD_ROOT%{sysconf_dir}/wx-console.conf $RPM_BUILD_ROOT%{sysconf_dir}/wxconsole.conf
%endif
# now clean up permissions that are left broken by the install
%if ! %{client_only}
-chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql
+chmod o-r $RPM_BUILD_ROOT%{script_dir}/query.sql
%endif
chmod o-rwx $RPM_BUILD_ROOT%{working_dir}
%if %{gconsole} && ! %{rh8}
chmod 755 $RPM_BUILD_ROOT/usr/sbin/bacula-tray-monitor
-chmod 644 $RPM_BUILD_ROOT/etc/bacula/tray-monitor.conf
+chmod 644 $RPM_BUILD_ROOT%{sysconf_dir}/tray-monitor.conf
%endif
# fix me - building enable-client-only installs files not included in bacula-client package
%if %{client_only}
-rm -f $RPM_BUILD_ROOT/etc/bacula/bacula
-rm -f $RPM_BUILD_ROOT/etc/bacula/bacula-ctl-dir
-rm -f $RPM_BUILD_ROOT/etc/bacula/bacula-ctl-sd
-rm -f $RPM_BUILD_ROOT/etc/bacula/disk-changer
-rm -f $RPM_BUILD_ROOT/etc/bacula/dvd-handler
-rm -f $RPM_BUILD_ROOT/etc/bacula/mtx-changer
-rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
-rm -rf $RPM_BUILD_ROOT/etc/bacula/updatedb
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-dir
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-sd
+rm -f $RPM_BUILD_ROOT%{script_dir}/disk-changer
+rm -f $RPM_BUILD_ROOT%{script_dir}/dvd-handler
+rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer
+rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
+rm -rf $RPM_BUILD_ROOT%{script_dir}/updatedb
%endif
%clean
# MySQL specific files
%files mysql
%defattr(-, root, root)
-%attr(-, root, %{daemon_group}) /etc/bacula/create_mysql_database
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_mysql_database
-%attr(-, root, %{daemon_group}) /etc/bacula/make_mysql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_mysql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/update_mysql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/grant_mysql_privileges
-%attr(-, root, %{daemon_group}) /etc/bacula/startmysql
-%attr(-, root, %{daemon_group}) /etc/bacula/stopmysql
+%attr(-, root, %{daemon_group}) %{script_dir}/create_mysql_database
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_database
+%attr(-, root, %{daemon_group}) %{script_dir}/make_mysql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/update_mysql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/grant_mysql_privileges
+%attr(-, root, %{daemon_group}) %{script_dir}/startmysql
+%attr(-, root, %{daemon_group}) %{script_dir}/stopmysql
%endif
%if %{sqlite}
%files sqlite
%defattr(-,root,root)
-%attr(-, root, %{daemon_group}) /etc/bacula/create_sqlite_database
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_sqlite_database
-%attr(-, root, %{daemon_group}) /etc/bacula/grant_sqlite_privileges
-%attr(-, root, %{daemon_group}) /etc/bacula/make_sqlite_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_sqlite_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/update_sqlite_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/create_sqlite_database
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite_database
+%attr(-, root, %{daemon_group}) %{script_dir}/grant_sqlite_privileges
+%attr(-, root, %{daemon_group}) %{script_dir}/make_sqlite_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/update_sqlite_tables
%{sqlite_bindir}/libsqlite.a
%{sqlite_bindir}/sqlite.h
%{sqlite_bindir}/sqlite
%if %{postgresql}
%files postgresql
%defattr(-,root,root)
-%attr(-, root, %{daemon_group}) /etc/bacula/create_postgresql_database
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_postgresql_database
-%attr(-, root, %{daemon_group}) /etc/bacula/make_postgresql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_postgresql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/update_postgresql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/grant_postgresql_privileges
+%attr(-, root, %{daemon_group}) %{script_dir}/create_postgresql_database
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_database
+%attr(-, root, %{daemon_group}) %{script_dir}/make_postgresql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/update_postgresql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/grant_postgresql_privileges
%endif
# The rest is DB backend independent
%if ! %{client_only}
-%attr(-, root, %{daemon_group}) %dir /etc/bacula
-%attr(-, root, %{daemon_group}) /etc/bacula/bacula
-%attr(-, root, %{daemon_group}) /etc/bacula/bconsole
-%attr(-, root, %{daemon_group}) /etc/bacula/create_bacula_database
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_bacula_database
-%attr(-, root, %{daemon_group}) /etc/bacula/grant_bacula_privileges
-%attr(-, root, %{daemon_group}) /etc/bacula/make_bacula_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_bacula_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/update_bacula_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/make_catalog_backup
-%attr(-, root, %{daemon_group}) /etc/bacula/delete_catalog_backup
-%attr(-, root, %{daemon_group}) /etc/bacula/btraceback.dbx
-%attr(-, root, %{daemon_group}) /etc/bacula/btraceback.gdb
-%attr(-, root, %{daemon_group}) /etc/bacula/rescue
-%attr(-, root, %{daemon_group}) /etc/bacula/disk-changer
-%attr(-, root, %{daemon_group}) /etc/bacula/bacula-ctl-dir
-%attr(-, root, %{daemon_group}) /etc/bacula/bacula-ctl-fd
-%attr(-, root, %{daemon_group}) /etc/bacula/bacula-ctl-sd
+%attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula
+%attr(-, root, %{daemon_group}) %{script_dir}/bconsole
+%attr(-, root, %{daemon_group}) %{script_dir}/create_bacula_database
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_bacula_database
+%attr(-, root, %{daemon_group}) %{script_dir}/grant_bacula_privileges
+%attr(-, root, %{daemon_group}) %{script_dir}/make_bacula_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_bacula_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/update_bacula_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup
+%attr(-, root, %{daemon_group}) %{script_dir}/delete_catalog_backup
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
+%attr(-, root, %{daemon_group}) %{sysconf_dir}/rescue
+%attr(-, root, %{daemon_group}) %{script_dir}/disk-changer
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-dir
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-sd
%attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
%attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
-%attr(-, root, %{storage_daemon_group}) /etc/bacula/dvd-handler
+%attr(-, root, %{storage_daemon_group}) %{script_dir}/dvd-handler
%attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
-%attr(-, root, %{storage_daemon_group}) /etc/bacula/mtx-changer
+%attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer
%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
/etc/logrotate.d/bacula
/etc/log.d/scripts/services/bacula
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-dir.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
-%attr(-, root, %{storage_daemon_group}) %config(noreplace) /etc/bacula/bacula-sd.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-dir.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
+%attr(-, root, %{storage_daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-sd.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
%attr(-, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
%attr(-, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/services/bacula.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/query.sql
+%attr(-, root, %{daemon_group}) %config(noreplace) %{script_dir}/query.sql
%attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{working_dir}
echo "This bacula upgrade will update a bacula database from version 9 to 10."
echo "You appear to be running database version $DB_VER. You must first update"
echo "your database to version 9 and then install this upgrade. The alternative"
- echo "is to use /etc/bacula/drop_%{db_backend}_tables to delete all your your current"
+ echo "is to use %{script_dir}/drop_%{db_backend}_tables to delete all your your current"
echo "catalog information, then do the upgrade. Information on updating a"
echo "database older than version 9 can be found in the release notes."
exit 1
%endif
%if ! %{client_only}
-# check for and copy /etc/bacula/console.conf to bconsole.conf
-if [ -s /etc/bacula/console.conf ];then
- cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
+# check for and copy %{sysconf_dir}/console.conf to bconsole.conf
+if [ -s %{sysconf_dir}/console.conf ];then
+ cp -p %{sysconf_dir}/console.conf %{sysconf_dir}/bconsole.conf
fi
# create the daemon users and groups
if [ -z "$DB_VER" ]; then
echo "Hmm, doesn't look like you have an existing database."
echo "Granting privileges for MySQL user bacula..."
- /etc/bacula/grant_mysql_privileges
+ %{script_dir}/grant_mysql_privileges
echo "Creating MySQL bacula database..."
- /etc/bacula/create_mysql_database
+ %{script_dir}/create_mysql_database
echo "Creating bacula tables..."
- /etc/bacula/make_mysql_tables
+ %{script_dir}/make_mysql_tables
# check to see if we need to upgrade a 1.38 or lower database
elif [ "$DB_VER" -lt "10" ]; then
echo "Backing up your current database..."
mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
echo "Upgrading bacula database ..."
- /etc/bacula/update_mysql_tables
+ %{script_dir}/update_mysql_tables
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
echo "Backing up your current database..."
echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
echo "Upgrading bacula database ..."
- /etc/bacula/update_sqlite_tables
+ %{script_dir}/update_sqlite_tables
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
else
# create the database and tables
echo "Hmm, doesn't look like you have an existing database."
echo "Creating SQLite database..."
- /etc/bacula/create_sqlite_database
+ %{script_dir}/create_sqlite_database
echo "Creating the SQLite tables..."
- /etc/bacula/make_sqlite_tables
+ %{script_dir}/make_sqlite_tables
fi
%endif
if [ -z "$DB_VER" ]; then
echo "Hmm, doesn't look like you have an existing database."
echo "Creating PostgreSQL bacula database..."
- /etc/bacula/create_postgresql_database
+ %{script_dir}/create_postgresql_database
echo "Creating bacula tables..."
- /etc/bacula/make_postgresql_tables
+ %{script_dir}/make_postgresql_tables
echo "Granting privileges for PostgreSQL user bacula..."
- /etc/bacula/grant_postgresql_privileges
+ %{script_dir}/grant_postgresql_privileges
# check to see if we need to upgrade a 1.38 or lower database
elif [ "$DB_VER" -lt "10" ]; then
echo "Backing up your current database..."
pg_dump bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
echo "Upgrading bacula database ..."
- /etc/bacula/update_postgresql_tables
+ %{script_dir}/update_postgresql_tables
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
%if ! %{client_only}
# generate passwords if needed
-if [ -d /etc/bacula ]; then
- cd /etc/bacula
+if [ -d %{sysconf_dir} ]; then
+ cd %{sysconf_dir}
for file in *.conf; do
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
need_password=`grep $string $file 2>/dev/null`
%{_mandir}/man1/tapeinfo.1.%{manpage_ext}
%endif
-
%files client
%defattr(-,root,root)
-%attr(-, root, %{daemon_group}) %dir /etc/bacula
-%attr(-, root, %{daemon_group}) /etc/bacula/bconsole
-/etc/bacula/bacula-ctl-fd
+%attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %{script_dir}/bconsole
+%{script_dir}/bacula-ctl-fd
/etc/init.d/bacula-fd
-%attr(-, root, %{daemon_group}) /etc/bacula/rescue
+%attr(-, root, %{daemon_group}) %{sysconf_dir}/rescue
%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
/etc/logrotate.d/bacula
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
%attr(-, root, %{daemon_group}) %dir %{working_dir}
/usr/sbin/bacula-fd
/usr/sbin/btraceback
-%attr(-, root, %{daemon_group}) /etc/bacula/btraceback.gdb
-%attr(-, root, %{daemon_group}) /etc/bacula/btraceback.dbx
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
/usr/sbin/bconsole
%{_mandir}/man8/bacula-fd.8.%{manpage_ext}
%{_mandir}/man8/bacula.8.%{manpage_ext}
fi
# generate passwords if needed
-if [ -d /etc/bacula ]; then
- cd /etc/bacula
+if [ -d %{sysconf_dir} ]; then
+ cd %{sysconf_dir}
for file in *.conf; do
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
need_password=`grep $string $file 2>/dev/null`
%if ! %{client_only}
%files updatedb
%defattr(-,root,%{daemon_group})
-/etc/bacula/updatedb/*
+%{script_dir}/updatedb/*
%pre updatedb
# create the daemon group
fi
%post updatedb
-echo "The database update scripts were installed to /etc/bacula/updatedb"
+echo "The database update scripts were installed to %{script_dir}/updatedb"
%endif
%if %{gconsole}
%files gconsole
%defattr(-,root,root)
/usr/sbin/gnome-console
-%attr(-, root, %{daemon_group}) %dir /etc/bacula
-%attr(-, root, %{daemon_group}) /etc/bacula/gconsole
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/gnome-console.conf
+%attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %{script_dir}/gconsole
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/gnome-console.conf
/usr/share/pixmaps/bacula.png
/usr/share/applications/bacula.desktop
%{_mandir}/man1/bacula-console-gnome.1.%{manpage_ext}
%if %{gconsole} && ! %{rh8}
/usr/sbin/bacula-tray-monitor
-%config(noreplace) /etc/bacula/tray-monitor.conf
+%config(noreplace) %{sysconf_dir}/tray-monitor.conf
/usr/share/pixmaps/bacula-tray-monitor.xpm
/usr/share/applications/bacula-tray-monitor.desktop
%{_mandir}/man1/bacula-tray-monitor.1.%{manpage_ext}
%post gconsole
# generate passwords if needed
-if [ -d /etc/bacula ]; then
- cd /etc/bacula
+if [ -d %{sysconf_dir} ]; then
+ cd %{sysconf_dir}
for file in *.conf; do
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
need_password=`grep $string $file 2>/dev/null`
%files wxconsole
%defattr(-,root,root)
/usr/sbin/wxconsole
-%attr(-, root, %{daemon_group}) %dir /etc/bacula
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/wxconsole.conf
+%attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/wxconsole.conf
/usr/share/pixmaps/wxwin16x16.xpm
/usr/share/applications/wxconsole.desktop
%{_mandir}/man1/bacula-wxconsole.1.%{manpage_ext}
%post wxconsole
# generate passwords if needed
-if [ -d /etc/bacula ]; then
- cd /etc/bacula
+if [ -d %{sysconf_dir} ]; then
+ cd %{sysconf_dir}
for file in *.conf; do
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
need_password=`grep $string $file 2>/dev/null`
%endif
%changelog
+* Sat Apr 08 2007 D. Scott Barninger <barninger@fairfieldcomputers.com>
+- merge Otto Mueller's patch but keep script dir set to /etc/bacula
+- add build tag for Scientific Linux per Jon Peatfield <J.S.Peatfield@damtp.cam.ac.uk>
+* Tue Mar 27 2007 Otto Mueller <otto.mueller@bundestag.de>
+- adjust directory locations for FHS-compatibility
+ sysconf_dir (/etc/bacula), script_dir (/usr/lib/bacula),
+ working_dir (/var/lib/bacula) and pid_dir (/var/run)
* Mon Feb 26 2007 D. Scott Barninger <barninger@fairfieldcomputers.com>
- add SuSE 10.2 target
* Sat Jan 20 2007 D. Scott Barninger <barninger@fairfieldcomputers.com>
# directory locations
%define sqlite_bindir /usr/lib/bacula/sqlite
-%define working_dir /var/bacula
%define _docsrc ../%{name}-docs-%{docs_version}
%define _rescuesrc ../%{name}-rescue-%{_rescuever}
%define depkgs ../depkgs
%define _mandir /usr/share/man
+# directory locations for FHS-compatibility
+%define sysconf_dir /etc/bacula
+%define script_dir /etc/bacula
+%define working_dir /var/lib/bacula
+%define pid_dir /var/run
+
# NOTE these defines are used in some rather complex useradd and groupadd
# commands. If you change them examine the post scripts for consequences.
%define director_daemon_user bacula
%define centos4 0
%{?build_centos4:%define centos4 1}
%{?build_centos4:%define fc3 1}
+# SL build
+%define sl3 0
+%{?build_sl3:%define sl3 1}
+%{?build_sl3:%define wb3 1}
+%define sl4 0
+%{?build_sl4:%define sl4 1}
+%{?build_sl4:%define fc3 1}
# SuSE build
%define su9 0
%{?build_su9:%define su9 1}
%if %{centos4} || %{centos3}
%define _dist %(grep CentOS /etc/redhat-release)
%endif
-%if %{fc3} && ! %{rhel4} && ! %{centos4}
+%if %{sl4} || %{sl3}
+%define _dist %(grep 'Scientific Linux' /etc/redhat-release)
+%endif
+%if %{fc3} && ! %{rhel4} && ! %{centos4} && ! %{sl4}
%define _dist %(grep Fedora /etc/redhat-release)
%endif
-%if %{wb3} && ! %{rhel3} && ! %{centos3}
+%if %{wb3} && ! %{rhel3} && ! %{centos3} && ! %{sl3}
%define _dist %(grep White /etc/whitebox-release)
%endif
%if %{su9} || %{su10} || %{su102}
%configure \
--prefix=/usr \
--sbindir=/usr/sbin \
- --sysconfdir=/etc/bacula \
- --with-scriptdir=/etc/bacula \
+ --sysconfdir=%{sysconf_dir} \
+ --with-scriptdir=%{script_dir} \
+ --with-working-dir=%{working_dir} \
+ --with-pid-dir=%{pid_dir} \
--enable-smartalloc \
--enable-client-only \
%if %{mdk}
%configure \
--prefix=/usr \
--sbindir=/usr/sbin \
- --sysconfdir=/etc/bacula \
- --with-scriptdir=/etc/bacula \
+ --sysconfdir=%{sysconf_dir} \
+ --with-scriptdir=%{script_dir} \
+ --with-working-dir=%{working_dir} \
+ --with-pid-dir=%{pid_dir} \
--enable-smartalloc \
%if %{gconsole}
--enable-gnome \
--enable-client-only \
%endif
--mandir=%{_mandir} \
- --with-working-dir=%{working_dir} \
- --with-pid-dir=/var/run \
--with-subsys-dir=/var/lock/subsys \
--with-dir-user=%{director_daemon_user} \
--with-dir-group=%{daemon_group} \
mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/logfiles
mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/services
mkdir -p $RPM_BUILD_ROOT/etc/log.d/scripts/services
-mkdir -p $RPM_BUILD_ROOT/etc/bacula/updatedb
+mkdir -p $RPM_BUILD_ROOT%{script_dir}/updatedb
%if %{gconsole} || %{wxconsole}
mkdir -p $RPM_BUILD_ROOT/usr/share/applications
make \
prefix=$RPM_BUILD_ROOT/usr \
sbindir=$RPM_BUILD_ROOT/usr/sbin \
- sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
- scriptdir=$RPM_BUILD_ROOT/etc/bacula \
+ sysconfdir=$RPM_BUILD_ROOT%{sysconf_dir} \
+ scriptdir=$RPM_BUILD_ROOT%{script_dir} \
working_dir=$RPM_BUILD_ROOT%{working_dir} \
+ piddir=$RPM_BUILD_ROOT%{pid_dir} \
mandir=$RPM_BUILD_ROOT%{_mandir} \
install
make \
prefix=$RPM_BUILD_ROOT/usr \
sbindir=$RPM_BUILD_ROOT/usr/sbin \
- sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
+ sysconfdir=$RPM_BUILD_ROOT%{sysconf_dir} \
+ scriptdir=$RPM_BUILD_ROOT%{script_dir} \
working_dir=$RPM_BUILD_ROOT%{working_dir} \
+ piddir=$RPM_BUILD_ROOT%{pid_dir} \
mandir=$RPM_BUILD_ROOT%{_mandir} \
mtx-install
cd ${cwd}
# fixme - make installs the mysql scripts for sqlite build
%if %{sqlite}
-rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
+rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/grant_mysql_privileges
%endif
# fixme - make installs the mysql scripts for postgresql build
%if %{postgresql}
-rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
%endif
# fixme - make installs gconsole script for build without gconsole
%if ! %{gconsole}
-rm -f $RPM_BUILD_ROOT/etc/bacula/gconsole
+rm -f $RPM_BUILD_ROOT%{script_dir}/gconsole
%endif
rm -f $RPM_BUILD_ROOT/usr/sbin/static-bacula-fd
cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
# install the updatedb scripts
-cp -p updatedb/* $RPM_BUILD_ROOT/etc/bacula/updatedb/
+cp -p updatedb/* $RPM_BUILD_ROOT%{script_dir}/updatedb/
# install the logwatch scripts
%if ! %{client_only}
%endif
# install the rescue files
-mkdir $RPM_BUILD_ROOT/etc/bacula/rescue
-cp -p %{_rescuesrc}/Makefile* $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -p %{_rescuesrc}/README $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -p %{_rescuesrc}/configure $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -p %{_rescuesrc}/version.h $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -pr %{_rescuesrc}/linux $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -pr %{_rescuesrc}/autoconf $RPM_BUILD_ROOT/etc/bacula/rescue/
-touch $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/rpm_release
-cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/bacula/bin/bacula-fd
+mkdir $RPM_BUILD_ROOT%{sysconf_dir}/rescue
+cp -p %{_rescuesrc}/Makefile* $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -p %{_rescuesrc}/README $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -p %{_rescuesrc}/configure $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -p %{_rescuesrc}/version.h $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -pr %{_rescuesrc}/linux $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -pr %{_rescuesrc}/autoconf $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+touch $RPM_BUILD_ROOT%{sysconf_dir}/rescue/linux/cdrom/rpm_release
+cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT%{sysconf_dir}/rescue/linux/cdrom/bacula/bin/bacula-fd
rm -f src/filed/static-bacula-fd
%if %{wxconsole}
mv $RPM_BUILD_ROOT/usr/sbin/wx-console $RPM_BUILD_ROOT/usr/sbin/wxconsole
-mv $RPM_BUILD_ROOT/etc/bacula/wx-console.conf $RPM_BUILD_ROOT/etc/bacula/wxconsole.conf
+mv $RPM_BUILD_ROOT%{sysconf_dir}/wx-console.conf $RPM_BUILD_ROOT%{sysconf_dir}/wxconsole.conf
%endif
# now clean up permissions that are left broken by the install
%if ! %{client_only}
-chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql
+chmod o-r $RPM_BUILD_ROOT%{script_dir}/query.sql
%endif
chmod o-rwx $RPM_BUILD_ROOT%{working_dir}
%if %{gconsole} && ! %{rh8}
chmod 755 $RPM_BUILD_ROOT/usr/sbin/bacula-tray-monitor
-chmod 644 $RPM_BUILD_ROOT/etc/bacula/tray-monitor.conf
+chmod 644 $RPM_BUILD_ROOT%{sysconf_dir}/tray-monitor.conf
%endif
# fix me - building enable-client-only installs files not included in bacula-client package
%if %{client_only}
-rm -f $RPM_BUILD_ROOT/etc/bacula/bacula
-rm -f $RPM_BUILD_ROOT/etc/bacula/bacula-ctl-dir
-rm -f $RPM_BUILD_ROOT/etc/bacula/bacula-ctl-sd
-rm -f $RPM_BUILD_ROOT/etc/bacula/disk-changer
-rm -f $RPM_BUILD_ROOT/etc/bacula/dvd-handler
-rm -f $RPM_BUILD_ROOT/etc/bacula/mtx-changer
-rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
-rm -rf $RPM_BUILD_ROOT/etc/bacula/updatedb
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-dir
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-sd
+rm -f $RPM_BUILD_ROOT%{script_dir}/disk-changer
+rm -f $RPM_BUILD_ROOT%{script_dir}/dvd-handler
+rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer
+rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
+rm -rf $RPM_BUILD_ROOT%{script_dir}/updatedb
%endif
%clean
# MySQL specific files
%files mysql
%defattr(-, root, root)
-%attr(-, root, %{daemon_group}) /etc/bacula/create_mysql_database
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_mysql_database
-%attr(-, root, %{daemon_group}) /etc/bacula/make_mysql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_mysql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/update_mysql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/grant_mysql_privileges
-%attr(-, root, %{daemon_group}) /etc/bacula/startmysql
-%attr(-, root, %{daemon_group}) /etc/bacula/stopmysql
+%attr(-, root, %{daemon_group}) %{script_dir}/create_mysql_database
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_database
+%attr(-, root, %{daemon_group}) %{script_dir}/make_mysql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/update_mysql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/grant_mysql_privileges
+%attr(-, root, %{daemon_group}) %{script_dir}/startmysql
+%attr(-, root, %{daemon_group}) %{script_dir}/stopmysql
%endif
%if %{sqlite}
%files sqlite
%defattr(-,root,root)
-%attr(-, root, %{daemon_group}) /etc/bacula/create_sqlite_database
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_sqlite_database
-%attr(-, root, %{daemon_group}) /etc/bacula/grant_sqlite_privileges
-%attr(-, root, %{daemon_group}) /etc/bacula/make_sqlite_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_sqlite_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/update_sqlite_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/create_sqlite_database
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite_database
+%attr(-, root, %{daemon_group}) %{script_dir}/grant_sqlite_privileges
+%attr(-, root, %{daemon_group}) %{script_dir}/make_sqlite_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/update_sqlite_tables
%{sqlite_bindir}/libsqlite.a
%{sqlite_bindir}/sqlite.h
%{sqlite_bindir}/sqlite
%if %{postgresql}
%files postgresql
%defattr(-,root,root)
-%attr(-, root, %{daemon_group}) /etc/bacula/create_postgresql_database
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_postgresql_database
-%attr(-, root, %{daemon_group}) /etc/bacula/make_postgresql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_postgresql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/update_postgresql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/grant_postgresql_privileges
+%attr(-, root, %{daemon_group}) %{script_dir}/create_postgresql_database
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_database
+%attr(-, root, %{daemon_group}) %{script_dir}/make_postgresql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/update_postgresql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/grant_postgresql_privileges
%endif
# The rest is DB backend independent
%if ! %{client_only}
-%attr(-, root, %{daemon_group}) %dir /etc/bacula
-%attr(-, root, %{daemon_group}) /etc/bacula/bacula
-%attr(-, root, %{daemon_group}) /etc/bacula/bconsole
-%attr(-, root, %{daemon_group}) /etc/bacula/create_bacula_database
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_bacula_database
-%attr(-, root, %{daemon_group}) /etc/bacula/grant_bacula_privileges
-%attr(-, root, %{daemon_group}) /etc/bacula/make_bacula_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_bacula_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/update_bacula_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/make_catalog_backup
-%attr(-, root, %{daemon_group}) /etc/bacula/delete_catalog_backup
-%attr(-, root, %{daemon_group}) /etc/bacula/btraceback.dbx
-%attr(-, root, %{daemon_group}) /etc/bacula/btraceback.gdb
-%attr(-, root, %{daemon_group}) /etc/bacula/rescue
-%attr(-, root, %{daemon_group}) /etc/bacula/disk-changer
-%attr(-, root, %{daemon_group}) /etc/bacula/bacula-ctl-dir
-%attr(-, root, %{daemon_group}) /etc/bacula/bacula-ctl-fd
-%attr(-, root, %{daemon_group}) /etc/bacula/bacula-ctl-sd
+%attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula
+%attr(-, root, %{daemon_group}) %{script_dir}/bconsole
+%attr(-, root, %{daemon_group}) %{script_dir}/create_bacula_database
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_bacula_database
+%attr(-, root, %{daemon_group}) %{script_dir}/grant_bacula_privileges
+%attr(-, root, %{daemon_group}) %{script_dir}/make_bacula_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_bacula_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/update_bacula_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup
+%attr(-, root, %{daemon_group}) %{script_dir}/delete_catalog_backup
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
+%attr(-, root, %{daemon_group}) %{sysconf_dir}/rescue
+%attr(-, root, %{daemon_group}) %{script_dir}/disk-changer
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-dir
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-sd
%attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
%attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
-%attr(-, root, %{storage_daemon_group}) /etc/bacula/dvd-handler
+%attr(-, root, %{storage_daemon_group}) %{script_dir}/dvd-handler
%attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
-%attr(-, root, %{storage_daemon_group}) /etc/bacula/mtx-changer
+%attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer
%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
/etc/logrotate.d/bacula
/etc/log.d/scripts/services/bacula
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-dir.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
-%attr(-, root, %{storage_daemon_group}) %config(noreplace) /etc/bacula/bacula-sd.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-dir.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
+%attr(-, root, %{storage_daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-sd.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
%attr(-, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
%attr(-, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/services/bacula.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/query.sql
+%attr(-, root, %{daemon_group}) %config(noreplace) %{script_dir}/query.sql
%attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{working_dir}
echo "This bacula upgrade will update a bacula database from version 9 to 10."
echo "You appear to be running database version $DB_VER. You must first update"
echo "your database to version 9 and then install this upgrade. The alternative"
- echo "is to use /etc/bacula/drop_%{db_backend}_tables to delete all your your current"
+ echo "is to use %{script_dir}/drop_%{db_backend}_tables to delete all your your current"
echo "catalog information, then do the upgrade. Information on updating a"
echo "database older than version 9 can be found in the release notes."
exit 1
%endif
%if ! %{client_only}
-# check for and copy /etc/bacula/console.conf to bconsole.conf
-if [ -s /etc/bacula/console.conf ];then
- cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
+# check for and copy %{sysconf_dir}/console.conf to bconsole.conf
+if [ -s %{sysconf_dir}/console.conf ];then
+ cp -p %{sysconf_dir}/console.conf %{sysconf_dir}/bconsole.conf
fi
# create the daemon users and groups
if [ -z "$DB_VER" ]; then
echo "Hmm, doesn't look like you have an existing database."
echo "Granting privileges for MySQL user bacula..."
- /etc/bacula/grant_mysql_privileges
+ %{script_dir}/grant_mysql_privileges
echo "Creating MySQL bacula database..."
- /etc/bacula/create_mysql_database
+ %{script_dir}/create_mysql_database
echo "Creating bacula tables..."
- /etc/bacula/make_mysql_tables
+ %{script_dir}/make_mysql_tables
# check to see if we need to upgrade a 1.38 or lower database
elif [ "$DB_VER" -lt "10" ]; then
echo "Backing up your current database..."
mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
echo "Upgrading bacula database ..."
- /etc/bacula/update_mysql_tables
+ %{script_dir}/update_mysql_tables
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
echo "Backing up your current database..."
echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
echo "Upgrading bacula database ..."
- /etc/bacula/update_sqlite_tables
+ %{script_dir}/update_sqlite_tables
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
else
# create the database and tables
echo "Hmm, doesn't look like you have an existing database."
echo "Creating SQLite database..."
- /etc/bacula/create_sqlite_database
+ %{script_dir}/create_sqlite_database
echo "Creating the SQLite tables..."
- /etc/bacula/make_sqlite_tables
+ %{script_dir}/make_sqlite_tables
fi
%endif
if [ -z "$DB_VER" ]; then
echo "Hmm, doesn't look like you have an existing database."
echo "Creating PostgreSQL bacula database..."
- /etc/bacula/create_postgresql_database
+ %{script_dir}/create_postgresql_database
echo "Creating bacula tables..."
- /etc/bacula/make_postgresql_tables
+ %{script_dir}/make_postgresql_tables
echo "Granting privileges for PostgreSQL user bacula..."
- /etc/bacula/grant_postgresql_privileges
+ %{script_dir}/grant_postgresql_privileges
# check to see if we need to upgrade a 1.38 or lower database
elif [ "$DB_VER" -lt "10" ]; then
echo "Backing up your current database..."
pg_dump bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
echo "Upgrading bacula database ..."
- /etc/bacula/update_postgresql_tables
+ %{script_dir}/update_postgresql_tables
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
%if ! %{client_only}
# generate passwords if needed
-if [ -d /etc/bacula ]; then
- cd /etc/bacula
+if [ -d %{sysconf_dir} ]; then
+ cd %{sysconf_dir}
for file in *.conf; do
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
need_password=`grep $string $file 2>/dev/null`
%{_mandir}/man1/tapeinfo.1.%{manpage_ext}
%endif
-
%files client
%defattr(-,root,root)
-%attr(-, root, %{daemon_group}) %dir /etc/bacula
-%attr(-, root, %{daemon_group}) /etc/bacula/bconsole
-/etc/bacula/bacula-ctl-fd
+%attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %{script_dir}/bconsole
+%{script_dir}/bacula-ctl-fd
/etc/init.d/bacula-fd
-%attr(-, root, %{daemon_group}) /etc/bacula/rescue
+%attr(-, root, %{daemon_group}) %{sysconf_dir}/rescue
%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
/etc/logrotate.d/bacula
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
%attr(-, root, %{daemon_group}) %dir %{working_dir}
/usr/sbin/bacula-fd
/usr/sbin/btraceback
-%attr(-, root, %{daemon_group}) /etc/bacula/btraceback.gdb
-%attr(-, root, %{daemon_group}) /etc/bacula/btraceback.dbx
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
/usr/sbin/bconsole
%{_mandir}/man8/bacula-fd.8.%{manpage_ext}
%{_mandir}/man8/bacula.8.%{manpage_ext}
fi
# generate passwords if needed
-if [ -d /etc/bacula ]; then
- cd /etc/bacula
+if [ -d %{sysconf_dir} ]; then
+ cd %{sysconf_dir}
for file in *.conf; do
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
need_password=`grep $string $file 2>/dev/null`
%if ! %{client_only}
%files updatedb
%defattr(-,root,%{daemon_group})
-/etc/bacula/updatedb/*
+%{script_dir}/updatedb/*
%pre updatedb
# create the daemon group
fi
%post updatedb
-echo "The database update scripts were installed to /etc/bacula/updatedb"
+echo "The database update scripts were installed to %{script_dir}/updatedb"
%endif
%if %{gconsole}
%files gconsole
%defattr(-,root,root)
/usr/sbin/gnome-console
-%attr(-, root, %{daemon_group}) %dir /etc/bacula
-%attr(-, root, %{daemon_group}) /etc/bacula/gconsole
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/gnome-console.conf
+%attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %{script_dir}/gconsole
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/gnome-console.conf
/usr/share/pixmaps/bacula.png
/usr/share/applications/bacula.desktop
%{_mandir}/man1/bacula-console-gnome.1.%{manpage_ext}
%if %{gconsole} && ! %{rh8}
/usr/sbin/bacula-tray-monitor
-%config(noreplace) /etc/bacula/tray-monitor.conf
+%config(noreplace) %{sysconf_dir}/tray-monitor.conf
/usr/share/pixmaps/bacula-tray-monitor.xpm
/usr/share/applications/bacula-tray-monitor.desktop
%{_mandir}/man1/bacula-tray-monitor.1.%{manpage_ext}
%post gconsole
# generate passwords if needed
-if [ -d /etc/bacula ]; then
- cd /etc/bacula
+if [ -d %{sysconf_dir} ]; then
+ cd %{sysconf_dir}
for file in *.conf; do
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
need_password=`grep $string $file 2>/dev/null`
%files wxconsole
%defattr(-,root,root)
/usr/sbin/wxconsole
-%attr(-, root, %{daemon_group}) %dir /etc/bacula
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/wxconsole.conf
+%attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/wxconsole.conf
/usr/share/pixmaps/wxwin16x16.xpm
/usr/share/applications/wxconsole.desktop
%{_mandir}/man1/bacula-wxconsole.1.%{manpage_ext}
%post wxconsole
# generate passwords if needed
-if [ -d /etc/bacula ]; then
- cd /etc/bacula
+if [ -d %{sysconf_dir} ]; then
+ cd %{sysconf_dir}
for file in *.conf; do
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
need_password=`grep $string $file 2>/dev/null`
%endif
%changelog
+* Sat Apr 08 2007 D. Scott Barninger <barninger@fairfieldcomputers.com>
+- merge Otto Mueller's patch but keep script dir set to /etc/bacula
+- add build tag for Scientific Linux per Jon Peatfield <J.S.Peatfield@damtp.cam.ac.uk>
+* Tue Mar 27 2007 Otto Mueller <otto.mueller@bundestag.de>
+- adjust directory locations for FHS-compatibility
+ sysconf_dir (/etc/bacula), script_dir (/usr/lib/bacula),
+ working_dir (/var/lib/bacula) and pid_dir (/var/run)
* Mon Feb 26 2007 D. Scott Barninger <barninger@fairfieldcomputers.com>
- add SuSE 10.2 target
* Sat Jan 20 2007 D. Scott Barninger <barninger@fairfieldcomputers.com>
# directory locations
%define sqlite_bindir /usr/lib/bacula/sqlite
-%define working_dir /var/bacula
%define _docsrc ../%{name}-docs-%{docs_version}
%define _rescuesrc ../%{name}-rescue-%{_rescuever}
%define depkgs ../depkgs
%define _mandir /usr/share/man
+# directory locations for FHS-compatibility
+%define sysconf_dir /etc/bacula
+%define script_dir /etc/bacula
+%define working_dir /var/lib/bacula
+%define pid_dir /var/run
+
# NOTE these defines are used in some rather complex useradd and groupadd
# commands. If you change them examine the post scripts for consequences.
%define director_daemon_user bacula
%define centos4 0
%{?build_centos4:%define centos4 1}
%{?build_centos4:%define fc3 1}
+# SL build
+%define sl3 0
+%{?build_sl3:%define sl3 1}
+%{?build_sl3:%define wb3 1}
+%define sl4 0
+%{?build_sl4:%define sl4 1}
+%{?build_sl4:%define fc3 1}
# SuSE build
%define su9 0
%{?build_su9:%define su9 1}
%if %{centos4} || %{centos3}
%define _dist %(grep CentOS /etc/redhat-release)
%endif
-%if %{fc3} && ! %{rhel4} && ! %{centos4}
+%if %{sl4} || %{sl3}
+%define _dist %(grep 'Scientific Linux' /etc/redhat-release)
+%endif
+%if %{fc3} && ! %{rhel4} && ! %{centos4} && ! %{sl4}
%define _dist %(grep Fedora /etc/redhat-release)
%endif
-%if %{wb3} && ! %{rhel3} && ! %{centos3}
+%if %{wb3} && ! %{rhel3} && ! %{centos3} && ! %{sl3}
%define _dist %(grep White /etc/whitebox-release)
%endif
%if %{su9} || %{su10} || %{su102}
%configure \
--prefix=/usr \
--sbindir=/usr/sbin \
- --sysconfdir=/etc/bacula \
- --with-scriptdir=/etc/bacula \
+ --sysconfdir=%{sysconf_dir} \
+ --with-scriptdir=%{script_dir} \
+ --with-working-dir=%{working_dir} \
+ --with-pid-dir=%{pid_dir} \
--enable-smartalloc \
--enable-client-only \
%if %{mdk}
%configure \
--prefix=/usr \
--sbindir=/usr/sbin \
- --sysconfdir=/etc/bacula \
- --with-scriptdir=/etc/bacula \
+ --sysconfdir=%{sysconf_dir} \
+ --with-scriptdir=%{script_dir} \
+ --with-working-dir=%{working_dir} \
+ --with-pid-dir=%{pid_dir} \
--enable-smartalloc \
%if %{gconsole}
--enable-gnome \
--enable-client-only \
%endif
--mandir=%{_mandir} \
- --with-working-dir=%{working_dir} \
- --with-pid-dir=/var/run \
--with-subsys-dir=/var/lock/subsys \
--with-dir-user=%{director_daemon_user} \
--with-dir-group=%{daemon_group} \
mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/logfiles
mkdir -p $RPM_BUILD_ROOT/etc/log.d/conf/services
mkdir -p $RPM_BUILD_ROOT/etc/log.d/scripts/services
-mkdir -p $RPM_BUILD_ROOT/etc/bacula/updatedb
+mkdir -p $RPM_BUILD_ROOT%{script_dir}/updatedb
%if %{gconsole} || %{wxconsole}
mkdir -p $RPM_BUILD_ROOT/usr/share/applications
make \
prefix=$RPM_BUILD_ROOT/usr \
sbindir=$RPM_BUILD_ROOT/usr/sbin \
- sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
- scriptdir=$RPM_BUILD_ROOT/etc/bacula \
+ sysconfdir=$RPM_BUILD_ROOT%{sysconf_dir} \
+ scriptdir=$RPM_BUILD_ROOT%{script_dir} \
working_dir=$RPM_BUILD_ROOT%{working_dir} \
+ piddir=$RPM_BUILD_ROOT%{pid_dir} \
mandir=$RPM_BUILD_ROOT%{_mandir} \
install
make \
prefix=$RPM_BUILD_ROOT/usr \
sbindir=$RPM_BUILD_ROOT/usr/sbin \
- sysconfdir=$RPM_BUILD_ROOT/etc/bacula \
+ sysconfdir=$RPM_BUILD_ROOT%{sysconf_dir} \
+ scriptdir=$RPM_BUILD_ROOT%{script_dir} \
working_dir=$RPM_BUILD_ROOT%{working_dir} \
+ piddir=$RPM_BUILD_ROOT%{pid_dir} \
mandir=$RPM_BUILD_ROOT%{_mandir} \
mtx-install
cd ${cwd}
# fixme - make installs the mysql scripts for sqlite build
%if %{sqlite}
-rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/grant_mysql_privileges
+rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/grant_mysql_privileges
%endif
# fixme - make installs the mysql scripts for postgresql build
%if %{postgresql}
-rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
%endif
# fixme - make installs gconsole script for build without gconsole
%if ! %{gconsole}
-rm -f $RPM_BUILD_ROOT/etc/bacula/gconsole
+rm -f $RPM_BUILD_ROOT%{script_dir}/gconsole
%endif
rm -f $RPM_BUILD_ROOT/usr/sbin/static-bacula-fd
cp -p scripts/logrotate $RPM_BUILD_ROOT/etc/logrotate.d/bacula
# install the updatedb scripts
-cp -p updatedb/* $RPM_BUILD_ROOT/etc/bacula/updatedb/
+cp -p updatedb/* $RPM_BUILD_ROOT%{script_dir}/updatedb/
# install the logwatch scripts
%if ! %{client_only}
%endif
# install the rescue files
-mkdir $RPM_BUILD_ROOT/etc/bacula/rescue
-cp -p %{_rescuesrc}/Makefile* $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -p %{_rescuesrc}/README $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -p %{_rescuesrc}/configure $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -p %{_rescuesrc}/version.h $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -pr %{_rescuesrc}/linux $RPM_BUILD_ROOT/etc/bacula/rescue/
-cp -pr %{_rescuesrc}/autoconf $RPM_BUILD_ROOT/etc/bacula/rescue/
-touch $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/rpm_release
-cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT/etc/bacula/rescue/linux/cdrom/bacula/bin/bacula-fd
+mkdir $RPM_BUILD_ROOT%{sysconf_dir}/rescue
+cp -p %{_rescuesrc}/Makefile* $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -p %{_rescuesrc}/README $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -p %{_rescuesrc}/configure $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -p %{_rescuesrc}/version.h $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -pr %{_rescuesrc}/linux $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+cp -pr %{_rescuesrc}/autoconf $RPM_BUILD_ROOT%{sysconf_dir}/rescue/
+touch $RPM_BUILD_ROOT%{sysconf_dir}/rescue/linux/cdrom/rpm_release
+cp -p src/filed/static-bacula-fd $RPM_BUILD_ROOT%{sysconf_dir}/rescue/linux/cdrom/bacula/bin/bacula-fd
rm -f src/filed/static-bacula-fd
%if %{wxconsole}
mv $RPM_BUILD_ROOT/usr/sbin/wx-console $RPM_BUILD_ROOT/usr/sbin/wxconsole
-mv $RPM_BUILD_ROOT/etc/bacula/wx-console.conf $RPM_BUILD_ROOT/etc/bacula/wxconsole.conf
+mv $RPM_BUILD_ROOT%{sysconf_dir}/wx-console.conf $RPM_BUILD_ROOT%{sysconf_dir}/wxconsole.conf
%endif
# now clean up permissions that are left broken by the install
%if ! %{client_only}
-chmod o-r $RPM_BUILD_ROOT/etc/bacula/query.sql
+chmod o-r $RPM_BUILD_ROOT%{script_dir}/query.sql
%endif
chmod o-rwx $RPM_BUILD_ROOT%{working_dir}
%if %{gconsole} && ! %{rh8}
chmod 755 $RPM_BUILD_ROOT/usr/sbin/bacula-tray-monitor
-chmod 644 $RPM_BUILD_ROOT/etc/bacula/tray-monitor.conf
+chmod 644 $RPM_BUILD_ROOT%{sysconf_dir}/tray-monitor.conf
%endif
# fix me - building enable-client-only installs files not included in bacula-client package
%if %{client_only}
-rm -f $RPM_BUILD_ROOT/etc/bacula/bacula
-rm -f $RPM_BUILD_ROOT/etc/bacula/bacula-ctl-dir
-rm -f $RPM_BUILD_ROOT/etc/bacula/bacula-ctl-sd
-rm -f $RPM_BUILD_ROOT/etc/bacula/disk-changer
-rm -f $RPM_BUILD_ROOT/etc/bacula/dvd-handler
-rm -f $RPM_BUILD_ROOT/etc/bacula/mtx-changer
-rm -f $RPM_BUILD_ROOT/etc/bacula/startmysql
-rm -f $RPM_BUILD_ROOT/etc/bacula/stopmysql
-rm -rf $RPM_BUILD_ROOT/etc/bacula/updatedb
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-dir
+rm -f $RPM_BUILD_ROOT%{script_dir}/bacula-ctl-sd
+rm -f $RPM_BUILD_ROOT%{script_dir}/disk-changer
+rm -f $RPM_BUILD_ROOT%{script_dir}/dvd-handler
+rm -f $RPM_BUILD_ROOT%{script_dir}/mtx-changer
+rm -f $RPM_BUILD_ROOT%{script_dir}/startmysql
+rm -f $RPM_BUILD_ROOT%{script_dir}/stopmysql
+rm -rf $RPM_BUILD_ROOT%{script_dir}/updatedb
%endif
%clean
# MySQL specific files
%files mysql
%defattr(-, root, root)
-%attr(-, root, %{daemon_group}) /etc/bacula/create_mysql_database
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_mysql_database
-%attr(-, root, %{daemon_group}) /etc/bacula/make_mysql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_mysql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/update_mysql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/grant_mysql_privileges
-%attr(-, root, %{daemon_group}) /etc/bacula/startmysql
-%attr(-, root, %{daemon_group}) /etc/bacula/stopmysql
+%attr(-, root, %{daemon_group}) %{script_dir}/create_mysql_database
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_database
+%attr(-, root, %{daemon_group}) %{script_dir}/make_mysql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_mysql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/update_mysql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/grant_mysql_privileges
+%attr(-, root, %{daemon_group}) %{script_dir}/startmysql
+%attr(-, root, %{daemon_group}) %{script_dir}/stopmysql
%endif
%if %{sqlite}
%files sqlite
%defattr(-,root,root)
-%attr(-, root, %{daemon_group}) /etc/bacula/create_sqlite_database
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_sqlite_database
-%attr(-, root, %{daemon_group}) /etc/bacula/grant_sqlite_privileges
-%attr(-, root, %{daemon_group}) /etc/bacula/make_sqlite_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_sqlite_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/update_sqlite_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/create_sqlite_database
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite_database
+%attr(-, root, %{daemon_group}) %{script_dir}/grant_sqlite_privileges
+%attr(-, root, %{daemon_group}) %{script_dir}/make_sqlite_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_sqlite_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/update_sqlite_tables
%{sqlite_bindir}/libsqlite.a
%{sqlite_bindir}/sqlite.h
%{sqlite_bindir}/sqlite
%if %{postgresql}
%files postgresql
%defattr(-,root,root)
-%attr(-, root, %{daemon_group}) /etc/bacula/create_postgresql_database
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_postgresql_database
-%attr(-, root, %{daemon_group}) /etc/bacula/make_postgresql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_postgresql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/update_postgresql_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/grant_postgresql_privileges
+%attr(-, root, %{daemon_group}) %{script_dir}/create_postgresql_database
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_database
+%attr(-, root, %{daemon_group}) %{script_dir}/make_postgresql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_postgresql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/update_postgresql_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/grant_postgresql_privileges
%endif
# The rest is DB backend independent
%if ! %{client_only}
-%attr(-, root, %{daemon_group}) %dir /etc/bacula
-%attr(-, root, %{daemon_group}) /etc/bacula/bacula
-%attr(-, root, %{daemon_group}) /etc/bacula/bconsole
-%attr(-, root, %{daemon_group}) /etc/bacula/create_bacula_database
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_bacula_database
-%attr(-, root, %{daemon_group}) /etc/bacula/grant_bacula_privileges
-%attr(-, root, %{daemon_group}) /etc/bacula/make_bacula_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/drop_bacula_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/update_bacula_tables
-%attr(-, root, %{daemon_group}) /etc/bacula/make_catalog_backup
-%attr(-, root, %{daemon_group}) /etc/bacula/delete_catalog_backup
-%attr(-, root, %{daemon_group}) /etc/bacula/btraceback.dbx
-%attr(-, root, %{daemon_group}) /etc/bacula/btraceback.gdb
-%attr(-, root, %{daemon_group}) /etc/bacula/rescue
-%attr(-, root, %{daemon_group}) /etc/bacula/disk-changer
-%attr(-, root, %{daemon_group}) /etc/bacula/bacula-ctl-dir
-%attr(-, root, %{daemon_group}) /etc/bacula/bacula-ctl-fd
-%attr(-, root, %{daemon_group}) /etc/bacula/bacula-ctl-sd
+%attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula
+%attr(-, root, %{daemon_group}) %{script_dir}/bconsole
+%attr(-, root, %{daemon_group}) %{script_dir}/create_bacula_database
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_bacula_database
+%attr(-, root, %{daemon_group}) %{script_dir}/grant_bacula_privileges
+%attr(-, root, %{daemon_group}) %{script_dir}/make_bacula_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/drop_bacula_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/update_bacula_tables
+%attr(-, root, %{daemon_group}) %{script_dir}/make_catalog_backup
+%attr(-, root, %{daemon_group}) %{script_dir}/delete_catalog_backup
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
+%attr(-, root, %{daemon_group}) %{sysconf_dir}/rescue
+%attr(-, root, %{daemon_group}) %{script_dir}/disk-changer
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-dir
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-fd
+%attr(-, root, %{daemon_group}) %{script_dir}/bacula-ctl-sd
%attr(-, root, %{daemon_group}) /etc/init.d/bacula-dir
%attr(-, root, %{daemon_group}) /etc/init.d/bacula-fd
-%attr(-, root, %{storage_daemon_group}) /etc/bacula/dvd-handler
+%attr(-, root, %{storage_daemon_group}) %{script_dir}/dvd-handler
%attr(-, root, %{storage_daemon_group}) /etc/init.d/bacula-sd
-%attr(-, root, %{storage_daemon_group}) /etc/bacula/mtx-changer
+%attr(-, root, %{storage_daemon_group}) %{script_dir}/mtx-changer
%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
/etc/logrotate.d/bacula
/etc/log.d/scripts/services/bacula
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-dir.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
-%attr(-, root, %{storage_daemon_group}) %config(noreplace) /etc/bacula/bacula-sd.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-dir.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
+%attr(-, root, %{storage_daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-sd.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
%attr(-, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/logfiles/bacula.conf
%attr(-, root, %{daemon_group}) %config(noreplace) /etc/log.d/conf/services/bacula.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/query.sql
+%attr(-, root, %{daemon_group}) %config(noreplace) %{script_dir}/query.sql
%attr(-, %{storage_daemon_user}, %{daemon_group}) %dir %{working_dir}
echo "This bacula upgrade will update a bacula database from version 9 to 10."
echo "You appear to be running database version $DB_VER. You must first update"
echo "your database to version 9 and then install this upgrade. The alternative"
- echo "is to use /etc/bacula/drop_%{db_backend}_tables to delete all your your current"
+ echo "is to use %{script_dir}/drop_%{db_backend}_tables to delete all your your current"
echo "catalog information, then do the upgrade. Information on updating a"
echo "database older than version 9 can be found in the release notes."
exit 1
%endif
%if ! %{client_only}
-# check for and copy /etc/bacula/console.conf to bconsole.conf
-if [ -s /etc/bacula/console.conf ];then
- cp -p /etc/bacula/console.conf /etc/bacula/bconsole.conf
+# check for and copy %{sysconf_dir}/console.conf to bconsole.conf
+if [ -s %{sysconf_dir}/console.conf ];then
+ cp -p %{sysconf_dir}/console.conf %{sysconf_dir}/bconsole.conf
fi
# create the daemon users and groups
if [ -z "$DB_VER" ]; then
echo "Hmm, doesn't look like you have an existing database."
echo "Granting privileges for MySQL user bacula..."
- /etc/bacula/grant_mysql_privileges
+ %{script_dir}/grant_mysql_privileges
echo "Creating MySQL bacula database..."
- /etc/bacula/create_mysql_database
+ %{script_dir}/create_mysql_database
echo "Creating bacula tables..."
- /etc/bacula/make_mysql_tables
+ %{script_dir}/make_mysql_tables
# check to see if we need to upgrade a 1.38 or lower database
elif [ "$DB_VER" -lt "10" ]; then
echo "Backing up your current database..."
mysqldump -f --opt bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
echo "Upgrading bacula database ..."
- /etc/bacula/update_mysql_tables
+ %{script_dir}/update_mysql_tables
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
echo "Backing up your current database..."
echo ".dump" | %{sqlite_bindir}/sqlite %{working_dir}/bacula.db | bzip2 > %{working_dir}/bacula_backup.sql.bz2
echo "Upgrading bacula database ..."
- /etc/bacula/update_sqlite_tables
+ %{script_dir}/update_sqlite_tables
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
else
# create the database and tables
echo "Hmm, doesn't look like you have an existing database."
echo "Creating SQLite database..."
- /etc/bacula/create_sqlite_database
+ %{script_dir}/create_sqlite_database
echo "Creating the SQLite tables..."
- /etc/bacula/make_sqlite_tables
+ %{script_dir}/make_sqlite_tables
fi
%endif
if [ -z "$DB_VER" ]; then
echo "Hmm, doesn't look like you have an existing database."
echo "Creating PostgreSQL bacula database..."
- /etc/bacula/create_postgresql_database
+ %{script_dir}/create_postgresql_database
echo "Creating bacula tables..."
- /etc/bacula/make_postgresql_tables
+ %{script_dir}/make_postgresql_tables
echo "Granting privileges for PostgreSQL user bacula..."
- /etc/bacula/grant_postgresql_privileges
+ %{script_dir}/grant_postgresql_privileges
# check to see if we need to upgrade a 1.38 or lower database
elif [ "$DB_VER" -lt "10" ]; then
echo "Backing up your current database..."
pg_dump bacula | bzip2 > %{working_dir}/bacula_backup.sql.bz2
echo "Upgrading bacula database ..."
- /etc/bacula/update_postgresql_tables
+ %{script_dir}/update_postgresql_tables
echo "If bacula works correctly you can remove the backup file %{working_dir}/bacula_backup.sql.bz2"
fi
%if ! %{client_only}
# generate passwords if needed
-if [ -d /etc/bacula ]; then
- cd /etc/bacula
+if [ -d %{sysconf_dir} ]; then
+ cd %{sysconf_dir}
for file in *.conf; do
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
need_password=`grep $string $file 2>/dev/null`
%{_mandir}/man1/tapeinfo.1.%{manpage_ext}
%endif
-
%files client
%defattr(-,root,root)
-%attr(-, root, %{daemon_group}) %dir /etc/bacula
-%attr(-, root, %{daemon_group}) /etc/bacula/bconsole
-/etc/bacula/bacula-ctl-fd
+%attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %{script_dir}/bconsole
+%{script_dir}/bacula-ctl-fd
/etc/init.d/bacula-fd
-%attr(-, root, %{daemon_group}) /etc/bacula/rescue
+%attr(-, root, %{daemon_group}) %{sysconf_dir}/rescue
%doc COPYING ChangeLog ReleaseNotes VERIFYING kernstodo
%doc %{_docsrc}/manual/bacula.pdf %{_docsrc}/developers/developers.pdf %{_docsrc}/manual/bacula ../Release_Notes-%{version}-%{release}.txt
/etc/logrotate.d/bacula
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bacula-fd.conf
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/bconsole.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bacula-fd.conf
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/bconsole.conf
%attr(-, root, %{daemon_group}) %dir %{working_dir}
/usr/sbin/bacula-fd
/usr/sbin/btraceback
-%attr(-, root, %{daemon_group}) /etc/bacula/btraceback.gdb
-%attr(-, root, %{daemon_group}) /etc/bacula/btraceback.dbx
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.gdb
+%attr(-, root, %{daemon_group}) %{script_dir}/btraceback.dbx
/usr/sbin/bconsole
%{_mandir}/man8/bacula-fd.8.%{manpage_ext}
%{_mandir}/man8/bacula.8.%{manpage_ext}
fi
# generate passwords if needed
-if [ -d /etc/bacula ]; then
- cd /etc/bacula
+if [ -d %{sysconf_dir} ]; then
+ cd %{sysconf_dir}
for file in *.conf; do
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
need_password=`grep $string $file 2>/dev/null`
%if ! %{client_only}
%files updatedb
%defattr(-,root,%{daemon_group})
-/etc/bacula/updatedb/*
+%{script_dir}/updatedb/*
%pre updatedb
# create the daemon group
fi
%post updatedb
-echo "The database update scripts were installed to /etc/bacula/updatedb"
+echo "The database update scripts were installed to %{script_dir}/updatedb"
%endif
%if %{gconsole}
%files gconsole
%defattr(-,root,root)
/usr/sbin/gnome-console
-%attr(-, root, %{daemon_group}) %dir /etc/bacula
-%attr(-, root, %{daemon_group}) /etc/bacula/gconsole
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/gnome-console.conf
+%attr(-, root, %{daemon_group}) %dir %{script_dir}
+%attr(-, root, %{daemon_group}) %{script_dir}/gconsole
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/gnome-console.conf
/usr/share/pixmaps/bacula.png
/usr/share/applications/bacula.desktop
%{_mandir}/man1/bacula-console-gnome.1.%{manpage_ext}
%if %{gconsole} && ! %{rh8}
/usr/sbin/bacula-tray-monitor
-%config(noreplace) /etc/bacula/tray-monitor.conf
+%config(noreplace) %{sysconf_dir}/tray-monitor.conf
/usr/share/pixmaps/bacula-tray-monitor.xpm
/usr/share/applications/bacula-tray-monitor.desktop
%{_mandir}/man1/bacula-tray-monitor.1.%{manpage_ext}
%post gconsole
# generate passwords if needed
-if [ -d /etc/bacula ]; then
- cd /etc/bacula
+if [ -d %{sysconf_dir} ]; then
+ cd %{sysconf_dir}
for file in *.conf; do
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
need_password=`grep $string $file 2>/dev/null`
%files wxconsole
%defattr(-,root,root)
/usr/sbin/wxconsole
-%attr(-, root, %{daemon_group}) %dir /etc/bacula
-%attr(-, root, %{daemon_group}) %config(noreplace) /etc/bacula/wxconsole.conf
+%attr(-, root, %{daemon_group}) %dir %{sysconf_dir}
+%attr(-, root, %{daemon_group}) %config(noreplace) %{sysconf_dir}/wxconsole.conf
/usr/share/pixmaps/wxwin16x16.xpm
/usr/share/applications/wxconsole.desktop
%{_mandir}/man1/bacula-wxconsole.1.%{manpage_ext}
%post wxconsole
# generate passwords if needed
-if [ -d /etc/bacula ]; then
- cd /etc/bacula
+if [ -d %{sysconf_dir} ]; then
+ cd %{sysconf_dir}
for file in *.conf; do
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
need_password=`grep $string $file 2>/dev/null`
%endif
%changelog
+* Sat Apr 08 2007 D. Scott Barninger <barninger@fairfieldcomputers.com>
+- merge Otto Mueller's patch but keep script dir set to /etc/bacula
+- add build tag for Scientific Linux per Jon Peatfield <J.S.Peatfield@damtp.cam.ac.uk>
+* Tue Mar 27 2007 Otto Mueller <otto.mueller@bundestag.de>
+- adjust directory locations for FHS-compatibility
+ sysconf_dir (/etc/bacula), script_dir (/usr/lib/bacula),
+ working_dir (/var/lib/bacula) and pid_dir (/var/run)
* Mon Feb 26 2007 D. Scott Barninger <barninger@fairfieldcomputers.com>
- add SuSE 10.2 target
* Sat Jan 20 2007 D. Scott Barninger <barninger@fairfieldcomputers.com>