diff options
author | Andrew Lewman <andrew@torproject.org> | 2007-10-06 15:29:15 +0000 |
---|---|---|
committer | Andrew Lewman <andrew@torproject.org> | 2007-10-06 15:29:15 +0000 |
commit | f12748d8e913beb7b7c3e8b6f11b6813cd62677f (patch) | |
tree | fd62a9fe96d685110ccdbabf6918469d79b93816 /contrib/polipo | |
parent | 9f9b7291417ebc634b76efb04fbe70dd96698cee (diff) | |
download | tor-f12748d8e913beb7b7c3e8b6f11b6813cd62677f.tar.gz tor-f12748d8e913beb7b7c3e8b6f11b6813cd62677f.zip |
Update osx addsysuser for leopard.
svn:r11780
Diffstat (limited to 'contrib/polipo')
-rw-r--r-- | contrib/polipo/addsysuser | 73 |
1 files changed, 48 insertions, 25 deletions
diff --git a/contrib/polipo/addsysuser b/contrib/polipo/addsysuser index 7f1d79a97c..7b167eac00 100644 --- a/contrib/polipo/addsysuser +++ b/contrib/polipo/addsysuser @@ -3,6 +3,8 @@ # Original adduser 05 Feb 2002 by Jon L. Gardner # # Modified for Tor installer by Nick Mathewson +# 2007-06-12 Modified for leopard by Andrew Lewman + ROOTPROP=/ @@ -17,29 +19,50 @@ fi username=$1 realname=$2 homedir=$3 -# GID 20 is "staff" which is the default. Change it if you want. -gid=`niutil -readprop $ROOTPROP /groups/daemon gid` -if [ "x`niutil -list $ROOTPROP /users|cut -f2 -d' '|grep $username`" != "x" ]; then -echo The account $username already exists. -exit 0 +if [ -x /usr/bin/dscl ]; then + # Determine the gid of the daemon group + gid=`dscl . -read /groups/daemon gid` + if [ "x`dscl . -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 + echo Creating account for $username... + dscl . -create /users/$username + dscl . -create /users/$username _writers_tim_passwd $username + dscl . -create /users/$username realname $realname + dscl . -create /users/$username _writers_passwd $username + dscl . -create /users/$username gid $gid + dscl . -create /users/$username home $homedir + dscl . -create /users/$username name $username + dscl . -create /users/$username passwd '*' + dscl . -create /users/$username shell /dev/null +else + # Determine the gid of the daemon group + gid=`niutil -readprop $ROOTPROP /groups/daemon gid` + if [ "x`niutil -list $ROOTPROP /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 system uid (please be patient)..." + # Uids over 500 are for system users. + uiddef=`nidump passwd / | cut -d: -f3 | sort -n | grep -v '^[56789]..' |grep -v '^....$' | tail -n 1` + uiddef=`echo $uiddef + 1 |bc` + echo Creating account for $username... + niutil -create $ROOTPROP /users/$username + niutil -createprop $ROOTPROP /users/$username _writers_tim_passwd $username + niutil -createprop $ROOTPROP /users/$username realname $realname + niutil -createprop $ROOTPROP /users/$username _writers_passwd $username + niutil -createprop $ROOTPROP /users/$username uid $uiddef + #niutil -createprop $ROOTPROP /users/$username home_loc "<home_dir><url>afp://afp.server.com/Users/</url><path>$username</path></home_dir>" + niutil -createprop $ROOTPROP /users/$username gid $gid + niutil -createprop $ROOTPROP /users/$username home $homedir + niutil -createprop $ROOTPROP /users/$username name $username + niutil -createprop $ROOTPROP /users/$username passwd '*' + niutil -createprop $ROOTPROP /users/$username shell /dev/null 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 system uid (please be patient)..." -# Uids over 500 are for system users. -uiddef=`nidump passwd / | cut -d: -f3 | sort -n | grep -v '^[56789]..' |grep -v '^....$' | tail -n 1` -uiddef=`echo $uiddef + 1 |bc` -echo Creating account for $username... -niutil -create $ROOTPROP /users/$username -niutil -createprop $ROOTPROP /users/$username _writers_tim_passwd $username -niutil -createprop $ROOTPROP /users/$username realname $realname -niutil -createprop $ROOTPROP /users/$username _writers_passwd $username -niutil -createprop $ROOTPROP /users/$username uid $uiddef -#niutil -createprop $ROOTPROP /users/$username home_loc "<home_dir><url>afp://afp.server.com/Users/</url><path>$username</path></home_dir>" -niutil -createprop $ROOTPROP /users/$username gid $gid -niutil -createprop $ROOTPROP /users/$username home $homedir -niutil -createprop $ROOTPROP /users/$username name $username -niutil -createprop $ROOTPROP /users/$username passwd '*' -niutil -createprop $ROOTPROP /users/$username shell /dev/null |