Make EPEL dependency optional in RHEL

This commit is contained in:
Simone Caronni 2011-12-19 16:20:41 +01:00
parent 35cb8dbc37
commit 4dac1ea4c1

View File

@ -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 Name: bacula
Version: 5.2.3 Version: 5.2.3
Release: 1%{?dist} Release: 2%{?dist}
Summary: Cross platform network backup for Linux, Unix, Mac and Windows Summary: Cross platform network backup for Linux, Unix, Mac and Windows
# See LICENSE for details # See LICENSE for details
License: GPLv2 with exceptions 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: desktop-file-utils, python-devel, lzo-devel, sed
BuildRequires: libacl-devel, tetex-latex, tetex, ghostscript BuildRequires: libacl-devel, tetex-latex, tetex, ghostscript
BuildRequires: readline-devel, libcap-devel BuildRequires: readline-devel, libcap-devel
BuildRequires: fedora-usermgmt-devel
%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6 %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
BuildRequires: qt4-devel >= 4.6.2 BuildRequires: qt4-devel >= 4.6.2
@ -86,8 +95,10 @@ This package contains basic Bacula libraries.
%package common %package common
Summary: Common Bacula files Summary: Common Bacula files
Group: System Environment/Daemons Group: System Environment/Daemons
Requires(pre): fedora-usermgmt
Obsoletes: bacula-sysconfdir <= 2.4 Obsoletes: bacula-sysconfdir <= 2.4
Provides: group(%username) = %uid
Provides: user(%username) = %uid
%{?FE_USERADD_REQ}
%description common %description common
Bacula is a set of programs that allow you to manage the backup, 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 # Remove execution permissions from files we're packaging as docs later on
find updatedb -type f | xargs chmod -x find updatedb -type f | xargs chmod -x
%build %build
build() { build() {
export CFLAGS="$RPM_OPT_FLAGS -I%{_includedir}/ncurses" 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 pushd examples/nagios/check_bacula
CFLAGS="%{optflags}" %{__make} LIBS="-lpthread -ldl -lssl -lcrypto -lz" CFLAGS="%{optflags}" %{__make} LIBS="-lpthread -ldl -lssl -lcrypto -lz"
popd popd
%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6 %if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
pushd src/qt-console/tray-monitor pushd src/qt-console/tray-monitor
/usr/bin/qmake-qt4 /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 /usr/sbin/alternatives --install %{_libdir}/libbaccats-%{version}.so libbaccats-%{version}.so %{_libdir}/libbaccats-postgresql-%{version}.so 60
%preun director-mysql %preun director-mysql
if [ "$1" = 0 ]; then if [ "$1" = 0 ]; then
/usr/sbin/alternatives --remove libbaccats-%{version}.so %{_libdir}/libbaccats-mysql-%{version}.so /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 /usr/sbin/alternatives --remove libbaccats-%{version}.so %{_libdir}/libbaccats-postgresql-%{version}.so
fi fi
%pre common %pre common
/usr/sbin/fedora-groupadd 33 -r bacula &>/dev/null || : %__fe_groupadd %uid -r %username &>/dev/null || :
/usr/sbin/fedora-useradd 33 -r -s /sbin/nologin -d /var/spool/bacula -M \ %__fe_useradd %uid -r -s /sbin/nologin -d /var/spool/bacula -M \
-c 'Bacula Backup System' -g bacula bacula &>/dev/null || : -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 %if 0%{?fedora} >= 15 || 0%{?rhel} > 6
@ -531,6 +549,7 @@ if [ $1 -eq 1 ] ; then
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi fi
%preun client %preun client
if [ $1 -eq 0 ] ; then if [ $1 -eq 0 ] ; then
# Package removal, not upgrade # Package removal, not upgrade
@ -538,6 +557,7 @@ if [ $1 -eq 0 ] ; then
/bin/systemctl stop bacula-fd.service > /dev/null 2>&1 || : /bin/systemctl stop bacula-fd.service > /dev/null 2>&1 || :
fi fi
%postun client %postun client
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then 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 || : /bin/systemctl try-restart bacula-fd.service >/dev/null 2>&1 || :
fi fi
%triggerun client -- bacula-client < 5.0.3-10 %triggerun client -- bacula-client < 5.0.3-10
# Save the current service runlevel info # Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply bacula-fd # User must manually run systemd-sysv-convert --apply bacula-fd
@ -555,12 +576,14 @@ fi
/sbin/chkconfig --del bacula-fd >/dev/null 2>&1 || : /sbin/chkconfig --del bacula-fd >/dev/null 2>&1 || :
/bin/systemctl try-restart bacula-fd.service >/dev/null 2>&1 || : /bin/systemctl try-restart bacula-fd.service >/dev/null 2>&1 || :
%post director-common %post director-common
if [ $1 -eq 1 ] ; then if [ $1 -eq 1 ] ; then
# Initial installation # Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi fi
%preun director-common %preun director-common
if [ $1 -eq 0 ] ; then if [ $1 -eq 0 ] ; then
# Package removal, not upgrade # Package removal, not upgrade
@ -568,6 +591,7 @@ if [ $1 -eq 0 ] ; then
/bin/systemctl stop bacula-dir.service > /dev/null 2>&1 || : /bin/systemctl stop bacula-dir.service > /dev/null 2>&1 || :
fi fi
%postun director-common %postun director-common
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then 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 || : /bin/systemctl try-restart bacula-dir.service >/dev/null 2>&1 || :
fi fi
%triggerun director-common -- bacula-director-common < 5.0.3-10 %triggerun director-common -- bacula-director-common < 5.0.3-10
# Save the current service runlevel info # Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply bacula-dir # 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 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi fi
%preun storage %preun storage
if [ $1 -eq 0 ] ; then if [ $1 -eq 0 ] ; then
# Package removal, not upgrade # Package removal, not upgrade
@ -599,6 +625,7 @@ if [ $1 -eq 0 ] ; then
/bin/systemctl stop bacula-sd.service > /dev/null 2>&1 || : /bin/systemctl stop bacula-sd.service > /dev/null 2>&1 || :
fi fi
%postun storage %postun storage
/bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then 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 || : /bin/systemctl try-restart bacula-sd.service >/dev/null 2>&1 || :
fi fi
%triggerun storage -- bacula-storage-common < 5.0.3-10 %triggerun storage -- bacula-storage-common < 5.0.3-10
# Save the current service runlevel info # Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply bacula-sd # User must manually run systemd-sysv-convert --apply bacula-sd
@ -853,6 +881,11 @@ fi
%changelog %changelog
* Mon Dec 19 2011 Simone Caronni <negativo17@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@gmail.com> - 5.2.3-1 * Mon Dec 19 2011 Simone Caronni <negativo17@gmail.com> - 5.2.3-1
- Updated to 5.2.3. - Updated to 5.2.3.
- Remove fedora-usermgmt from libs Requires section. - Remove fedora-usermgmt from libs Requires section.