Updated mingw makefile for polipo to include forbidden functionality in
[tor.git] / debian / tor.postinst
blob7d607b6e68e33a4d8ea408541c0eaf0bd3f2d126
1 #!/bin/sh -e
3 # checking debian-tor account
5 uid=`getent passwd debian-tor | cut -d ":" -f 3`
6 home=`getent passwd debian-tor | cut -d ":" -f 6`
8 # if there is the uid the account is there and we can do
9 # the sanit(ar)y checks otherwise we can safely create it.
11 if [ "$uid" ]; then
12 if [ "$home" = "/var/lib/tor" ]; then
14 #echo "debian-tor homedir check: ok"
15 else
16 echo "ERROR: debian-tor account has an unexpected home directory!"
17 echo "It should be '/var/lib/tor', but it is '$home'."
18 echo "Removing the debian-tor user might fix this, but the question"
19 echo "remains how you got into this mess to begin with."
20 exit 1
22 else
23 adduser --quiet \
24 --system \
25 --disabled-password \
26 --home /var/lib/tor \
27 --no-create-home \
28 --shell /bin/bash \
29 --group \
30 debian-tor
34 for i in lib run log; do
35 if ! [ -d "/var/$i/tor" ]; then
36 echo "Something or somebody made /var/$i/tor disappear."
37 echo "Creating one for you again."
38 mkdir "/var/$i/tor"
40 done
42 find /var/lib/tor \( \( ! -user debian-tor \) -o \( ! -group debian-tor \) \) -print0 | xargs -0 --no-run-if-empty chown debian-tor:debian-tor
43 find /var/lib/tor -type d -print0 | xargs -0 --no-run-if-empty chmod 02700
44 find /var/lib/tor -type f -print0 | xargs -0 --no-run-if-empty chmod 00600
46 find /var/run/tor \( \( ! -user debian-tor \) -o \( ! -group debian-tor \) \) -print0 | xargs -0 --no-run-if-empty chown debian-tor:debian-tor
47 find /var/run/tor -type d -print0 | xargs -0 --no-run-if-empty chmod 02750
48 find /var/run/tor -type f -print0 | xargs -0 --no-run-if-empty chmod 00600
50 find /var/log/tor \( \( ! -user debian-tor \) -o \( ! -group adm \) \) -print0 | xargs -0 --no-run-if-empty chown debian-tor:adm
51 find /var/log/tor -type d -print0 | xargs -0 --no-run-if-empty chmod 02750
52 find /var/log/tor -type f -print0 | xargs -0 --no-run-if-empty chmod 00640
54 #DEBHELPER#
56 exit 0