~ubuntu-branches/ubuntu/edgy/tor/edgy

« back to all changes in this revision

Viewing changes to debian/tor.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Peter Palfrader
  • Date: 2004-06-07 21:46:08 UTC
  • Revision ID: james.westby@ubuntu.com-20040607214608-sis2wpmt00dfl7bs
Tags: 0.0.7-1
New upstream version
closes: #249893: FTBFS on ia64

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh -e
 
2
 
 
3
# checking debian-tor account
 
4
 
 
5
uid=`getent passwd debian-tor | cut -d ":" -f 3`
 
6
home=`getent passwd debian-tor | cut -d ":" -f 6`
 
7
 
 
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.
 
10
 
 
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
 
20
    fi
 
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
 
28
    fi
 
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
 
39
fi
 
40
 
 
41
# ch{owning,moding} things around
 
42
# We will do nothing across upgrades.
 
43
 
 
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
fi
 
51
 
 
52
#DEBHELPER#
 
53
 
 
54
exit 0