clean torrc sample
[tor.git] / debian / tor.postinst
blobcd2e91beeb3894b1bc4e65fe48c4cf9f05726dd7
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 # guess??? the checks!!!
13 if [ $uid -ge 100 ] && [ $uid -le 999 ]; then
14 echo "debian-tor uid check: ok"
15 else
16 echo "ERROR: debian-tor account has a non-system uid!"
17 echo "Please check /usr/share/doc/tor/README.Debian on how to"
18 echo "correct this problem"
19 exit 1
21 if [ "$home" = "/var/lib/tor" ]; then
22 echo "debian-tor homedir check: ok"
23 else
24 echo "ERROR: debian-tor account has an invalid home directory!"
25 echo "Please check /usr/share/doc/tor/README.Debian on how to"
26 echo "correct this problem"
27 exit 1
29 else
30 # what this might mean?? oh creating a system l^Huser!
31 adduser --quiet \
32 --system \
33 --disabled-password \
34 --home /var/lib/tor \
35 --no-create-home \
36 --shell /bin/bash \
37 --group \
38 debian-tor
41 # ch{owning,moding} things around
42 # We will do nothing across upgrades.
44 if [ "$2" = "" ]; then
45 for i in lib log run; do
46 chown -R debian-tor:debian-tor /var/$i/tor
47 chmod -R 700 /var/$i/tor
48 find /var/$i/tor -type f -exec chmod 600 '{}' ';'
49 done
52 #DEBHELPER#
54 exit 0