3 # File : privoxy-create-dscl.sh
5 # Purpose : Create the privoxy group and user for OS X 10.5,6,7,8
7 # Copyright : Written by and Copyright (C) 2001-2012 the
8 # Privoxy team. http://www.privoxy.org/
10 # This program is free software; you can redistribute it
11 # and/or modify it under the terms of the GNU General
12 # Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at
14 # your option) any later version.
16 # This program is distributed in the hope that it will
17 # be useful, but WITHOUT ANY WARRANTY; without even the
18 # implied warranty of MERCHANTABILITY or FITNESS FOR A
19 # PARTICULAR PURPOSE. See the GNU General Public
20 # License for more details.
22 # The GNU General Public License should be included with
23 # this file. If not, you can view it at
24 # http://www.gnu.org/copyleft/gpl.html
25 # or write to the Free Software Foundation, Inc.,
26 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
29 # Modification : If you modify this file please consider whether your
30 # changes ought to be passed back to the macsetup module.
34 # check for existing privoxy group and user
36 gname="`/usr/bin/dscl /Local/Default -list /groups | /usr/bin/grep -E '^(_)?privoxy?'`"
37 uname="`/usr/bin/dscl /Local/Default -list /users | /usr/bin/grep -E '^(_)?privoxy?'`"
42 if [ -z ${gname} ]; then
43 echo "Notice: creating a privoxy group."
44 gid1="`/usr/bin/dscl /Local/Default -list /groups gid | /usr/bin/awk '{print $2}' | /usr/bin/sort -n | /usr/bin/tail -1`"
45 gid="`/bin/expr ${gid1} + 1`"
47 /usr/bin/dscl /Local/Default -create /Groups/_privoxy
48 /usr/bin/dscl /Local/Default -append /Groups/_privoxy RecordName privoxy
49 /usr/bin/dscl /Local/Default -create /Groups/_privoxy Password "*"
50 /usr/bin/dscl /Local/Default -create /Groups/_privoxy PrimaryGroupID ${gid}
51 /usr/bin/dscl /Local/Default -create /Groups/_privoxy RealName "privoxy users"
53 echo "Notice: a privoxy group already exists."
59 if [ -z ${uname} ]; then
60 echo "Notice: creating a privoxy user."
61 uid1="`/usr/bin/dscl /Local/Default -list /users uid | /usr/bin/awk '{print $2}' | /usr/bin/sort -n | /usr/bin/tail -1`"
62 uid="`/bin/expr ${uid1} + 1`"
64 /usr/bin/dscl /Local/Default -create /Users/_privoxy
65 /usr/bin/dscl /Local/Default -append /Users/_privoxy RecordName privoxy
66 /usr/bin/dscl /Local/Default -create /Users/_privoxy NFSHomeDirectory /var/empty
67 /usr/bin/dscl /Local/Default -create /Users/_privoxy Password "*"
68 /usr/bin/dscl /Local/Default -create /Users/_privoxy PrimaryGroupID ${gid}
69 /usr/bin/dscl /Local/Default -create /Users/_privoxy RealName "privoxy server"
70 /usr/bin/dscl /Local/Default -create /Users/_privoxy UniqueID ${uid}
71 /usr/bin/dscl /Local/Default -create /Users/_privoxy UserShell /usr/bin/false
73 echo "Notice: a privoxy user already exists."