* Spec file options to create the Nix user and group in the RPM

pre-install script.  By default this is turned off; you should edit
  the spec file to enable it.
This commit is contained in:
Eelco Dolstra 2004-09-06 10:05:21 +00:00
parent fb28cfc86d
commit 17c8252fc9

View file

@ -1,12 +1,11 @@
# This RPM accepts the following defininitions (which can be passed %define enable_setuid ""
# using `--define' to rpmbuild, e.g., --define 'enable_setuid yes'): %define nix_user "nix"
# enable_setuid: if non-empty, pass `--enable-setuid' to configure %define nix_group "nix"
# nix_user: if set, pass as `--with-nix-user' to configure
# nix_group: if set, pass as `--with-nix-group' to configure
%{!?enable_setuid: %define enable_setuid ""} # If set, the Nix user and group will be created by the RPM
%{!?nix_user: %define nix_user ""} # pre-install script.
%{!?nix_group: %define nix_group ""} %define nix_user_uid ""
%define nix_group_gid ""
Summary: The Nix software deployment system Summary: The Nix software deployment system
Name: nix Name: nix
@ -51,8 +50,18 @@ strip $RPM_BUILD_ROOT/%{_prefix}/bin/* || true
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%pre
if test -n "%{nix_group_gid}"; then
/usr/sbin/groupadd -g %{nix_group_gid} %{nix_group} || true
fi
if test -n "%{nix_user_uid}"; then
/usr/sbin/useradd -c "Nix" -u %{nix_user_uid} \
-s /sbin/nologin -r -d /var/empty %{nix_user} \
-g %{nix_group} || true
fi
%files %files
%defattr(-,root,root) #%defattr(-,root,root)
%{_prefix}/bin %{_prefix}/bin
%{_prefix}/libexec %{_prefix}/libexec
%{_prefix}/var %{_prefix}/var