Hello,
I'm currently committing on bacula and I've stepped into a few problems with fedora-usermgmt. I think the process is a bit convoluted. It is not even in the guidelines for packaging, so I'm guessing if I can be removed it from the package.
According to this page, the yellow box points to another links and states clearly is not part of the packaging guidelines.
http://fedoraproject.org/wiki/PackageUserCreation
- Packages for RHEL 4/5/6 get a dependency on the EPEL repository, which many users would like to avoid on production systems. - Building the package gets a dependency on the EPEL repository for the fedora-usermgmt-devel package even if it is not used at installation time; so again the package cannot be built on RHEL without the EPEL repository. - "%bcond_without fedora", as suggested by the pages, does not work with RHEL 4, as the directive is invalid. - Koji does not accept "--without" arguments even for scratch builds, so I cannot pass the argument as suggested by the page. - Even if building only for RHEL 5+ I cannot build the same package on Koji but need to upload a different package for RHEL.
I also tried setting statically a lot %if / %else and distro tags to get a static with/without_fedora inside the spec file but I didn't make any success with it.
After a day of frustration I looked at other packages spec files that define uid/gid <100, and I saw that many of them don't use fedora-usermgmt at all (i.e. NetworkManager-openconnect):
fedoraproject.org/wiki/PackageUserRegistry
Basically I will remove all of this stuff:
%if 0%{?fedora} > 0 %define with_fedora 1 %else %define without_fedora 1 %endif
(or the non-working "%bcond_without fedora")
%global uid 33 %global username bacula
BuildRequires: fedora-usermgmt-devel %{?FE_USERADD_REQ}
%pre common %__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 || :
With:
Requires(pre): shadow-utils
%pre common %{_sbindir}/groupadd -g 33 -r bacula &>/dev/null || : %{_sbindir}/useradd -u 33 -r -s /sbin/nologin -d /var/spool/bacula -M \ -c 'Bacula Backup System' -g bacula bacula &>/dev/null || :
%postun common test "$1" != 0 || %{_sbindir}/userdel bacula &>/dev/null || : test "$1" != 0 || %{_sbindir}/groupdel bacula &>/dev/null || :
Can I simplify everything removing fedora-usermgmt as a requirement?
Thanks, --Simone