]> git.sommitrealweird.co.uk Git - onak.git/blob - debian/postinst
Escape colons and similar in MRHKP output
[onak.git] / debian / postinst
1 #! /bin/sh
2
3 set -e
4
5 if [ "$1" = "configure" ]; then
6
7     # Add the onak user
8     adduser --system --home /var/lib/onak --no-create-home --disabled-login onak
9
10     # 
11     # If there's no onak database, create it by adding my key.
12     #
13     if [ ! -e /var/lib/onak/num_keydb ]; then
14         zcat /usr/share/doc/onak/noodles.key | onak -b add
15     fi
16
17     # Take ownership of the database and spool directory
18     chown -R onak /var/lib/onak
19     chown -R onak /var/spool/onak
20
21     # Create our logfile
22     touch /var/log/onak.log
23     chown onak /var/log/onak.log
24
25     # Make the CGI tools setuid onak
26     for i in /usr/lib/cgi-bin/pks/*
27     do
28         if ! dpkg-statoverride --list $i >/dev/null
29         then
30             dpkg-statoverride --update --add onak root 4755 $i
31         fi
32     done
33
34     # If we don't have a DB backend defined, then add appropriate config
35     if ! grep -q db_backend /etc/onak.conf; then
36         echo "# Auto added on package update" >> /etc/onak.conf
37         echo "backends_dir /usr/lib/onak/backends" >> /etc/onak.conf
38         echo "db_backend db4" >> /etc/onak.conf
39     fi
40
41     # If we still have the old default mail_dir setting, fix it
42     if grep -q "mail_dir /community/pgp-keyserver/incoming" /etc/onak.conf; then
43         sed -i.bak "s/community\/pgp-keyserver\/incoming/var\/spool\/onak/" \
44                 /etc/onak.conf
45     fi
46
47 fi
48
49 #DEBHELPER#