#!/bin/sh # File : privoxy-create-dscl.sh # # Purpose : Create the privoxy group and user for OS X 10.5,6,7,8 # # Copyright : Written by and Copyright (C) 2001-2012 the # Privoxy team. http://www.privoxy.org/ # # This program is free software; you can redistribute it # and/or modify it under the terms of the GNU General # Public License as published by the Free Software # Foundation; either version 2 of the License, or (at # your option) any later version. # # This program is distributed in the hope that it will # be useful, but WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. See the GNU General Public # License for more details. # # The GNU General Public License should be included with # this file. If not, you can view it at # http://www.gnu.org/copyleft/gpl.html # or write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA # # Modification : If you modify this file please consider whether your # changes ought to be passed back to the OSXPackageBuilder # module. # # # check for existing privoxy group and user # gname="`/usr/bin/dscl /Local/Default -list /groups | /usr/bin/grep -E '^(_)?privoxy?'`" uname="`/usr/bin/dscl /Local/Default -list /users | /usr/bin/grep -E '^(_)?privoxy?'`" # # create group # if [ -z ${gname} ]; then echo "Notice: creating a privoxy group." gid1="`/usr/bin/dscl /Local/Default -list /groups gid | /usr/bin/awk '{print $2}' | /usr/bin/sort -n | /usr/bin/tail -1`" gid="`/bin/expr ${gid1} + 1`" /usr/bin/dscl /Local/Default -create /Groups/_privoxy /usr/bin/dscl /Local/Default -append /Groups/_privoxy RecordName privoxy /usr/bin/dscl /Local/Default -create /Groups/_privoxy Password "*" /usr/bin/dscl /Local/Default -create /Groups/_privoxy PrimaryGroupID ${gid} /usr/bin/dscl /Local/Default -create /Groups/_privoxy RealName "privoxy users" else echo "Notice: a privoxy group already exists." fi # # create user # if [ -z ${uname} ]; then echo "Notice: creating a privoxy user." uid1="`/usr/bin/dscl /Local/Default -list /users uid | /usr/bin/awk '{print $2}' | /usr/bin/sort -n | /usr/bin/tail -1`" uid="`/bin/expr ${uid1} + 1`" /usr/bin/dscl /Local/Default -create /Users/_privoxy /usr/bin/dscl /Local/Default -append /Users/_privoxy RecordName privoxy /usr/bin/dscl /Local/Default -create /Users/_privoxy NFSHomeDirectory /var/empty /usr/bin/dscl /Local/Default -create /Users/_privoxy Password "*" /usr/bin/dscl /Local/Default -create /Users/_privoxy PrimaryGroupID ${gid} /usr/bin/dscl /Local/Default -create /Users/_privoxy RealName "privoxy server" /usr/bin/dscl /Local/Default -create /Users/_privoxy UniqueID ${uid} /usr/bin/dscl /Local/Default -create /Users/_privoxy UserShell /usr/bin/false else echo "Notice: a privoxy user already exists." fi exit 0