5 if [ "$1" = "configure" ]; then
6 if dpkg --compare-versions -- "$2" le "0.4.6-1"; then
7 echo "Upgrading from old onak.conf version"
8 if [ -e /etc/onak.conf.dpkg-backup -a ! -e /etc/onak.conf ]; then
9 echo "Migrating onak.conf to onak.ini"
10 # Old config file was modified; generate a new style
11 # file. onak will use the file extension to determine it's
12 # an old style config, so we need the symlink.
13 ln -s /etc/onak.conf.dpkg-backup /etc/onak.conf
14 onak -c /etc/onak.conf dumpconfig /etc/onak.ini
20 adduser --system --home /var/lib/onak --no-create-home --disabled-login onak
22 # Take ownership of the database and spool directory
23 chown onak /var/lib/onak
24 chown onak /var/spool/onak
27 touch /var/log/onak.log
28 chown onak /var/log/onak.log
31 # If we're using a default config and there's no onak database, create it
34 if grep -q "^backend=defaultdb4" /etc/onak.ini &&
35 grep -q "^location=/var/lib/onak" /etc/onak.ini &&
36 [ ! -e /var/lib/onak/num_keydb -a \
37 -e /usr/share/doc/onak/noodles.key.gz ]; then
38 zcat /usr/share/doc/onak/noodles.key | runuser -u onak -- onak -b add
41 # Make the CGI tools setuid onak
42 for i in /usr/lib/cgi-bin/pks/*
44 if ! dpkg-statoverride --list $i >/dev/null
46 dpkg-statoverride --update --add onak root 4755 $i
54 # With the move to systemd this will force systemd to start keyd even if it's
55 # disabled in the onak config file; the systemd service file can't check the
56 # way the init script does. Work around this by doing the check here and
57 # only calling invoke-rc.d if it's actually enabled.
59 if grep -q -E '^use_keyd=*(true|yes|1)$' /etc/onak.ini; then
60 invoke-rc.d onak start || exit $?