summaryrefslogtreecommitdiff
path: root/contrib/osx/addsysuser
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-01-05 02:46:25 +0000
committerNick Mathewson <nickm@torproject.org>2005-01-05 02:46:25 +0000
commit20142a2508b6fb486a7df4b61afae4522fd32571 (patch)
treeb0dc496d6fb31ea6f20489a8bf3aba8bb22d40e9 /contrib/osx/addsysuser
parent041edf87548688b67477b9216268d18501160a4e (diff)
downloadtor-20142a2508b6fb486a7df4b61afae4522fd32571.tar.gz
tor-20142a2508b6fb486a7df4b61afae4522fd32571.zip
Forward-port OSX packaging stuff from maint branch
svn:r3299
Diffstat (limited to 'contrib/osx/addsysuser')
-rwxr-xr-xcontrib/osx/addsysuser42
1 files changed, 42 insertions, 0 deletions
diff --git a/contrib/osx/addsysuser b/contrib/osx/addsysuser
new file mode 100755
index 0000000000..62d201fca2
--- /dev/null
+++ b/contrib/osx/addsysuser
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# Original adduser 05 Feb 2002 by Jon L. Gardner
+#
+# Modified for Tor installer by Nick Mathewson
+
+if [ "`whoami`" != "root" ]; then
+echo "You must be root to execute this script."
+exit
+fi
+if [ "x$3" = "x" ]; then
+echo 'Usage: addsysuser <username> "<full name>" <homedir>'
+exit 0
+fi
+username=$1
+realname=$2
+homedir=$3
+# GID 20 is "staff" which is the default. Change it if you want.
+gid=`niutil -readprop / /groups/daemon gid`
+if [ "x`niutil -list / /users|cut -f2 -d' '|grep $username`" != "x" ]; then
+echo The account $username already exists.
+exit 0
+fi
+# home is the local path to the home directory
+home=/Users/$username
+# defhome is what goes into NetInfo
+defhome="/Network/Servers/MyServer/Users"
+#echo "Determining next available uid (please be patient)..."
+uiddef=`nidump passwd / | cut -d: -f3 | sort -n | tail -n 1`
+uiddef=`echo $uiddef + 1 |bc`
+echo Creating account for $username...
+niutil -create / /users/$username
+niutil -createprop / /users/$username _writers_tim_passwd $username
+niutil -createprop / /users/$username realname $realname
+niutil -createprop / /users/$username _writers_passwd $username
+niutil -createprop / /users/$username uid $uiddef
+#niutil -createprop / /users/$username home_loc "<home_dir><url>afp://afp.server.com/Users/</url><path>$username</path></home_dir>"
+niutil -createprop / /users/$username gid $gid
+niutil -createprop / /users/$username home $homedir
+niutil -createprop / /users/$username name $username
+niutil -createprop / /users/$username passwd '*'
+niutil -createprop / /users/$username shell /dev/null