match-all.action no longer overwritten during installation if already present
[OSXPackageBuilder.git] / privoxy-create-nicl.sh
1 #!/bin/sh
2
3 # File        :  privoxy-create-nicl.sh
4 #
5 # Purpose     :  Create the privoxy group and user for OS X 10.3,4
6 #
7 # Copyright   :  Written by and Copyright (C) 2001-2012 the
8 #                Privoxy team. http://www.privoxy.org/
9 #
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.
15 #
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.
21 #
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,
27 #                USA
28 #
29 # Modification : If you modify this file please consider whether your 
30 #                changes ought to be passed back to the macsetup module.
31 #
32
33 #
34 # check for existing privoxy group and user
35 #
36 gname="`/usr/bin/nireport . /groups name | /usr/bin/grep -E '^privoxy?'`"
37 uname="`/usr/bin/nireport . /users name | /usr/bin/grep -E '^privoxy?'`"
38
39 #
40 # create group
41 #
42 if [ -z ${gname} ]; then
43   echo "Notice: creating a privoxy group."
44   gid1="`/usr/bin/nireport . /groups gid | /usr/bin/sort -n | /usr/bin/tail -1`"
45   gid="`/bin/expr ${gid1} + 1`"
46
47   /usr/bin/nicl . -create /groups/privoxy
48   /usr/bin/nicl . -create /groups/privoxy passwd "*"
49   /usr/bin/nicl . -create /groups/privoxy gid ${gid}
50 else
51   echo "Notice: a privoxy group already exists."
52 fi
53
54 #
55 # create user
56 #
57 if [ -z ${uname} ]; then
58   echo "Notice: creating a privoxy user."
59   uid1="`/usr/bin/nireport . /users uid | /usr/bin/sort -n | /usr/bin/tail -1`"
60   uid="`/bin/expr ${uid1} + 1`"
61
62   /usr/bin/nicl . -create /users/privoxy
63   /usr/bin/nicl . -create /users/privoxy passwd "*"
64   /usr/bin/nicl . -create /users/privoxy uid ${uid}
65   /usr/bin/nicl . -create /users/privoxy gid ${gid}
66   /usr/bin/nicl . -create /users/privoxy change 0
67   /usr/bin/nicl . -create /users/privoxy expire 0
68   /usr/bin/nicl . -create /users/privoxy realname "Privoxy Web Proxy"
69   /usr/bin/nicl . -create /users/privoxy home /var/empty
70   /usr/bin/nicl . -create /users/privoxy shell /usr/bin/false
71   /usr/bin/nicl . -create /users/privoxy _shadow_passwd ""
72 else
73   echo "Notice: a privoxy user already exists."
74 fi
75
76 exit 0