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 OSXPackageBuilder
35 # check for existing privoxy group and user
37 gname="`/usr/bin/dscl /Local/Default -list /groups | /usr/bin/grep -E '^(_)?privoxy?'`"
38 uname="`/usr/bin/dscl /Local/Default -list /users | /usr/bin/grep -E '^(_)?privoxy?'`"
43 if [ -z ${gname} ]; then
44 echo "Notice: creating a privoxy group."
45 gid1="`/usr/bin/dscl /Local/Default -list /groups gid | /usr/bin/awk '{print $2}' | /usr/bin/sort -n | /usr/bin/tail -1`"
46 gid="`/bin/expr ${gid1} + 1`"
48 /usr/bin/dscl /Local/Default -create /Groups/_privoxy
49 /usr/bin/dscl /Local/Default -append /Groups/_privoxy RecordName privoxy
50 /usr/bin/dscl /Local/Default -create /Groups/_privoxy Password "*"
51 /usr/bin/dscl /Local/Default -create /Groups/_privoxy PrimaryGroupID ${gid}
52 /usr/bin/dscl /Local/Default -create /Groups/_privoxy RealName "privoxy users"
54 echo "Notice: a privoxy group already exists."
60 if [ -z ${uname} ]; then
61 echo "Notice: creating a privoxy user."
62 uid1="`/usr/bin/dscl /Local/Default -list /users uid | /usr/bin/awk '{print $2}' | /usr/bin/sort -n | /usr/bin/tail -1`"
63 uid="`/bin/expr ${uid1} + 1`"
65 /usr/bin/dscl /Local/Default -create /Users/_privoxy
66 /usr/bin/dscl /Local/Default -append /Users/_privoxy RecordName privoxy
67 /usr/bin/dscl /Local/Default -create /Users/_privoxy NFSHomeDirectory /var/empty
68 /usr/bin/dscl /Local/Default -create /Users/_privoxy Password "*"
69 /usr/bin/dscl /Local/Default -create /Users/_privoxy PrimaryGroupID ${gid}
70 /usr/bin/dscl /Local/Default -create /Users/_privoxy RealName "privoxy server"
71 /usr/bin/dscl /Local/Default -create /Users/_privoxy UniqueID ${uid}
72 /usr/bin/dscl /Local/Default -create /Users/_privoxy UserShell /usr/bin/false
74 echo "Notice: a privoxy user already exists."