captive-sandbox-server: +Check user/group 'captive' in system files.
[captive.git] / src / client / sandbox-server / Makefile.am
index 0a41b75..80fa5a4 100644 (file)
@@ -31,6 +31,18 @@ install-data-hook:
        $(mkinstalldirs) $(DESTDIR)$(CAPTIVE_SANDBOX_CHROOT)/tmp
        chmod 1777 $(DESTDIR)$(CAPTIVE_SANDBOX_CHROOT)/tmp
 
+install-exec-hook:
+       if test `id -u` -eq 0 -a -z "$(DESTDIR)";then \
+               if grep -q '^$(CAPTIVE_SANDBOX_SETGID):' /etc/group;then true;else \
+                       echo "ERROR: Add '$(CAPTIVE_SANDBOX_SETGID)' to your '/etc/group'; see README and groupadd(8)"; \
+                       exit 1; \
+               fi; \
+               if grep -q '^$(CAPTIVE_SANDBOX_SETUID):' /etc/passwd;then true;else \
+                       echo "ERROR: Add '$(CAPTIVE_SANDBOX_SETUID)' to your '/etc/passwd'; see README and useradd(8)"; \
+                       exit 1; \
+               fi; \
+       fi
+
 EXTRA_DIST+=captive-sandbox-server.pod.pl.in
 CLEANFILES+=captive-sandbox-server.pod captive-sandbox-server.1
 if ENABLE_MAN_PAGES