Remove unnecessary copying of PCRE library files - the package template picks them...
[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 OSXPackageBuilder
31 #                module.
32 #
33
34 #
35 # check for existing privoxy group and user
36 #
37 gname="`/usr/bin/nireport . /groups name | /usr/bin/grep -E '^privoxy?'`"
38 uname="`/usr/bin/nireport . /users name | /usr/bin/grep -E '^privoxy?'`"
39
40 #
41 # create group
42 #
43 if [ -z ${gname} ]; then
44   echo "Notice: creating a privoxy group."
45   gid1="`/usr/bin/nireport . /groups gid | /usr/bin/sort -n | /usr/bin/tail -1`"
46   gid="`/bin/expr ${gid1} + 1`"
47
48   /usr/bin/nicl . -create /groups/privoxy
49   /usr/bin/nicl . -create /groups/privoxy passwd "*"
50   /usr/bin/nicl . -create /groups/privoxy gid ${gid}
51 else
52   echo "Notice: a privoxy group already exists."
53 fi
54
55 #
56 # create user
57 #
58 if [ -z ${uname} ]; then
59   echo "Notice: creating a privoxy user."
60   uid1="`/usr/bin/nireport . /users uid | /usr/bin/sort -n | /usr/bin/tail -1`"
61   uid="`/bin/expr ${uid1} + 1`"
62
63   /usr/bin/nicl . -create /users/privoxy
64   /usr/bin/nicl . -create /users/privoxy passwd "*"
65   /usr/bin/nicl . -create /users/privoxy uid ${uid}
66   /usr/bin/nicl . -create /users/privoxy gid ${gid}
67   /usr/bin/nicl . -create /users/privoxy change 0
68   /usr/bin/nicl . -create /users/privoxy expire 0
69   /usr/bin/nicl . -create /users/privoxy realname "Privoxy Web Proxy"
70   /usr/bin/nicl . -create /users/privoxy home /var/empty
71   /usr/bin/nicl . -create /users/privoxy shell /usr/bin/false
72   /usr/bin/nicl . -create /users/privoxy _shadow_passwd ""
73 else
74   echo "Notice: a privoxy user already exists."
75 fi
76
77 exit 0