Funny. I could have sworn that it compiled.
[tor.git] / debian / tor.postinst
blob3224a32607c1199d0fd965a9edb782d0db83cd91
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
50 chgrp -R adm /var/log/tor
51 chmod -R g+rX /var/log/tor
52 chmod g+s /var/log/tor
53 else
54 # fix permissions of logs after 0.0.8+0.0.9pre5-1
55 if [ "$1" = "configure" ]; then
56 if dpkg --compare-versions "$2" le "0.0.8+0.0.9pre5-1" ; then
57 chgrp -R adm /var/log/tor
58 chmod -R g+rX /var/log/tor
59 chmod g+s /var/log/tor
64 #DEBHELPER#
66 exit 0