[bacula] Make EPEL dependency optional in RHEL
Simone Caronni
slaanesh at fedoraproject.org
Mon Dec 19 15:24:53 UTC 2011
commit 4dac1ea4c1502dd726620747e9edee61ba33c0ef
Author: Simone Caronni <negativo17 at gmail.com>
Date: Mon Dec 19 16:20:41 2011 +0100
Make EPEL dependency optional in RHEL
bacula.spec | 45 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 39 insertions(+), 6 deletions(-)
---
diff --git a/bacula.spec b/bacula.spec
index c0b38dc..cc423c6 100644
--- a/bacula.spec
+++ b/bacula.spec
@@ -1,6 +1,14 @@
+# Avoid dependency on fedora-usermgmt at install time by passing "--without fedora".
+# http://fedoraproject.org/wiki/PackageUserCreation
+# Otherwise you can trigger disabling by default by setting "% bcond_with fedora"
+%bcond_without fedora
+
+%global username 33
+%global uid bacula
+
Name: bacula
Version: 5.2.3
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Cross platform network backup for Linux, Unix, Mac and Windows
# See LICENSE for details
License: GPLv2 with exceptions
@@ -37,6 +45,7 @@ BuildRequires: mysql-devel, postgresql-devel, sqlite-devel
BuildRequires: desktop-file-utils, python-devel, lzo-devel, sed
BuildRequires: libacl-devel, tetex-latex, tetex, ghostscript
BuildRequires: readline-devel, libcap-devel
+BuildRequires: fedora-usermgmt-devel
%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
BuildRequires: qt4-devel >= 4.6.2
@@ -86,8 +95,10 @@ This package contains basic Bacula libraries.
%package common
Summary: Common Bacula files
Group: System Environment/Daemons
-Requires(pre): fedora-usermgmt
Obsoletes: bacula-sysconfdir <= 2.4
+Provides: group(%username) = %uid
+Provides: user(%username) = %uid
+%{?FE_USERADD_REQ}
%description common
Bacula is a set of programs that allow you to manage the backup,
@@ -314,6 +325,7 @@ Provides check_bacula support for Nagios.
# Remove execution permissions from files we're packaging as docs later on
find updatedb -type f | xargs chmod -x
+
%build
build() {
export CFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/ncurses"
@@ -381,6 +393,7 @@ sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
pushd examples/nagios/check_bacula
CFLAGS="%{optflags}" %{__make} LIBS="-lpthread -ldl -lssl -lcrypto -lz"
popd
+
%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
pushd src/qt-console/tray-monitor
/usr/bin/qmake-qt4
@@ -500,7 +513,6 @@ rm -rf %{buildroot}
/usr/sbin/alternatives --install %{_libdir}/libbaccats-%{version}.so libbaccats-%{version}.so %{_libdir}/libbaccats-postgresql-%{version}.so 60
-
%preun director-mysql
if [ "$1" = 0 ]; then
/usr/sbin/alternatives --remove libbaccats-%{version}.so %{_libdir}/libbaccats-mysql-%{version}.so
@@ -518,10 +530,16 @@ if [ "$1" = 0 ]; then
/usr/sbin/alternatives --remove libbaccats-%{version}.so %{_libdir}/libbaccats-postgresql-%{version}.so
fi
+
%pre common
-/usr/sbin/fedora-groupadd 33 -r bacula &>/dev/null || :
-/usr/sbin/fedora-useradd 33 -r -s /sbin/nologin -d /var/spool/bacula -M \
- -c 'Bacula Backup System' -g bacula bacula &>/dev/null || :
+%__fe_groupadd %uid -r %username &>/dev/null || :
+%__fe_useradd %uid -r -s /sbin/nologin -d /var/spool/bacula -M \
+ -c 'Bacula Backup System' -g %username %username &>/dev/null || :
+
+%postun common
+%__fe_userdel %username &>/dev/null || :
+%__fe_groupdel %username &>/dev/null || :
+
%if 0%{?fedora} >= 15 || 0%{?rhel} > 6
@@ -531,6 +549,7 @@ if [ $1 -eq 1 ] ; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
+
%preun client
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
@@ -538,6 +557,7 @@ if [ $1 -eq 0 ] ; then
/bin/systemctl stop bacula-fd.service > /dev/null 2>&1 || :
fi
+
%postun client
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
@@ -545,6 +565,7 @@ if [ $1 -ge 1 ] ; then
/bin/systemctl try-restart bacula-fd.service >/dev/null 2>&1 || :
fi
+
%triggerun client -- bacula-client < 5.0.3-10
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply bacula-fd
@@ -555,12 +576,14 @@ fi
/sbin/chkconfig --del bacula-fd >/dev/null 2>&1 || :
/bin/systemctl try-restart bacula-fd.service >/dev/null 2>&1 || :
+
%post director-common
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
+
%preun director-common
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
@@ -568,6 +591,7 @@ if [ $1 -eq 0 ] ; then
/bin/systemctl stop bacula-dir.service > /dev/null 2>&1 || :
fi
+
%postun director-common
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
@@ -575,6 +599,7 @@ if [ $1 -ge 1 ] ; then
/bin/systemctl try-restart bacula-dir.service >/dev/null 2>&1 || :
fi
+
%triggerun director-common -- bacula-director-common < 5.0.3-10
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply bacula-dir
@@ -592,6 +617,7 @@ if [ $1 -eq 1 ] ; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
+
%preun storage
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
@@ -599,6 +625,7 @@ if [ $1 -eq 0 ] ; then
/bin/systemctl stop bacula-sd.service > /dev/null 2>&1 || :
fi
+
%postun storage
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
@@ -606,6 +633,7 @@ if [ $1 -ge 1 ] ; then
/bin/systemctl try-restart bacula-sd.service >/dev/null 2>&1 || :
fi
+
%triggerun storage -- bacula-storage-common < 5.0.3-10
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply bacula-sd
@@ -853,6 +881,11 @@ fi
%changelog
+* Mon Dec 19 2011 Simone Caronni <negativo17 at gmail.com> - 5.2.3-2
+- Remove leftover users when removing bacula-common.
+- Allow building "--without fedora" to avoid RHEL dependency on EPEL:
+ http://fedoraproject.org/wiki/PackageUserCreation
+
* Mon Dec 19 2011 Simone Caronni <negativo17 at gmail.com> - 5.2.3-1
- Updated to 5.2.3.
- Remove fedora-usermgmt from libs Requires section.
More information about the scm-commits
mailing list