about summary refs log tree commit diff
path: root/nix.spec.in
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-09-06T10·05+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-09-06T10·05+0000
commit17c8252fc932874b7ca9b7269c96b178022302f2 (patch)
treee7971e19c743b13656c57d8e05ec0df59e4bb838 /nix.spec.in
parentfb28cfc86dff6bbacb71f69a862afd3384aee986 (diff)
* 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.

Diffstat (limited to 'nix.spec.in')
-rw-r--r--nix.spec.in27
1 files changed, 18 insertions, 9 deletions
diff --git a/nix.spec.in b/nix.spec.in
index fc34067c17..65dc2fcb7d 100644
--- a/nix.spec.in
+++ b/nix.spec.in
@@ -1,12 +1,11 @@
-# This RPM accepts the following defininitions (which can be passed
-# using `--define' to rpmbuild, e.g., --define 'enable_setuid yes'):
-#   enable_setuid: if non-empty, pass `--enable-setuid' to configure
-#   nix_user: if set, pass as `--with-nix-user' to configure 
-#   nix_group: if set, pass as `--with-nix-group' to configure
+%define enable_setuid ""
+%define nix_user "nix"
+%define nix_group "nix"
 
-%{!?enable_setuid: %define enable_setuid ""}
-%{!?nix_user: %define nix_user ""}
-%{!?nix_group: %define nix_group ""}
+# If set, the Nix user and group will be created by the RPM
+# pre-install script.
+%define nix_user_uid ""
+%define nix_group_gid ""
 
 Summary: The Nix software deployment system
 Name: nix
@@ -51,8 +50,18 @@ strip $RPM_BUILD_ROOT/%{_prefix}/bin/* || true
 %clean
 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
-%defattr(-,root,root)
+#%defattr(-,root,root)
 %{_prefix}/bin
 %{_prefix}/libexec
 %{_prefix}/var