summaryrefslogtreecommitdiff
path: root/misc/dnetc/pkg-install
diff options
context:
space:
mode:
authorDaniel Baker <dbaker@FreeBSD.org>2001-12-04 01:43:20 +0000
committerDaniel Baker <dbaker@FreeBSD.org>2001-12-04 01:43:20 +0000
commit73aebacf35d506f974998a4a9e35b1a577b0c506 (patch)
tree7360349f1600e1ca208f914cca62d8db655d648a /misc/dnetc/pkg-install
parentUpgrade to 2.5.0. (diff)
Create a "dnetc" user and group that owns relevant dnetc
directories, files, and runs the client. This removes all reliance on the "nobody" account so that the account doesn't own any files or run any processes.
Notes
Notes: svn path=/head/; revision=51000
Diffstat (limited to '')
-rw-r--r--misc/dnetc/pkg-install32
1 files changed, 32 insertions, 0 deletions
diff --git a/misc/dnetc/pkg-install b/misc/dnetc/pkg-install
new file mode 100644
index 000000000000..d837ae3a40c4
--- /dev/null
+++ b/misc/dnetc/pkg-install
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+if [ "$2" != "PRE-INSTALL" ]; then
+ exit 0
+fi
+
+CLIENTUSER=$3
+CLIENTUID=$4
+CLIENTGROUP=$5
+CLIENTGID=$6
+
+if ! pw groupshow "$CLIENTGROUP" 2>/dev/null 1>&2; then
+ if pw groupadd $CLIENTGROUP -g $CLIENTGID; then
+ echo "=> Added group \"$CLIENTGROUP\"."
+ else
+ echo "=> Adding group \"$CLIENTGROUP\" failed..."
+ exit 1
+ fi
+fi
+
+if ! pw usershow "$CLIENTUSER" 2>/dev/null 1>&2; then
+ if pw useradd $CLIENTUSER -u $CLIENTUID -g $CLIENTGROUP -h - \
+ -s "/sbin/nologin" -d "/nonexistent" \
+ -c "distributed.net client and proxy pseudo-user"; \
+ then
+ echo "=> Added user \"$CLIENTUSER\"."
+ else
+ echo "=> Adding user \"$CLIENTUSER\" failed..."
+ exit 1
+ fi
+fi
+exit 0