#!/bin/sh -e . /usr/share/debconf/confmodule pks_dir=/var/lib/pks pks_cfg_file=/etc/pks/pksd.conf case "$1" in configure) # # Cleanup from older versions of the package which didn't install the # pks user as a system user. # if getent passwd pks > /dev/null && test `/usr/bin/id -u pks` -gt 999 then userdel pks || true if getent group pks > /dev/null then groupdel pks || true fi fi # # Use adduser as it does the right thing if the user exists. # adduser --quiet --system --group --home $pks_dir --shell /bin/sh \ --gecos "OpenPGP Keyserver" --disabled-login pks adduser --quiet pks mail # change ownership of pks working directory chown -R pks.pks $pks_dir chmod -R 770 $pks_dir # link pks_help default file to english one if [ ! -e /usr/share/doc/pks/pks_help ] then ln -sf /usr/share/doc/pks/pks_help.en.gz /usr/share/doc/pks/pks_help fi # add aliases for e-mail querys / server synchronization if ! grep -q "^#PGP Keyserver Begin" /etc/aliases then cat <> /etc/aliases #PGP Keyserver Begin pgp-public-keys: "|/usr/sbin/pks-mail.sh $pks_cfg_file" pgp: pgp-public-keys pks: pgp-public-keys #PGP Keyserver End EOF which newaliases > /dev/null && newaliases fi version="$2" if [ -z "$version" -o "$version" = "" ] then # There is no previous version of pks installed, so a new # configuration is due. Fill the configured values in the # configuration file db_get pks/hostname || true hostname="$RET" # this_site db_get pks/admin_email || true admin_email="$RET" # maintainer_email db_get pks/www_port || true www_port="$RET" # www_port db_get pks/www_updates || true if [ "$RET" = "true" ] then www_readonly="0" # www_readonly else www_readonly="1" fi db_get pks/max_reply_keys || true max_reply_keys="$RET" # max_reply_keys db_get pks/language || true language="$RET" # default_language TMPCFG=$(mktemp ${pks_cfg_file}-XXXXXX) cp -p $pks_cfg_file $TMPCFG sed -e"s/^maintainer_email .*$/maintainer_email $admin_email/" $TMPCFG \ | sed -e"s/^#* *this_site .*$/this_site pgp-public-keys@$hostname/" \ | sed -e"s/^www_port .*$/www_port $www_port/" \ | sed -e"s/^# www_readonly .*$/www_readonly $www_readonly/" \ | sed -e"s/^#* *max_reply_keys .*$/max_reply_keys $max_reply_keys/" \ | sed -e"s/^default_language .*$/default_language $language/" \ > $pks_cfg_file rm -f $TMPCFG # create the database files if not already there. if [ ! -f $pks_dir/db/keydb000 ] then db_get pks/num_db_files || true num_files="$RET" su pks -c "/usr/sbin/pksclient $pks_dir/db/ create \ $num_files" > /dev/null fi # If debian keyring is available on the system, add it to the # key server database. if [ -f /usr/share/keyrings/debian-keyring.gpg -a \ -r /usr/share/keyrings/debian-keyring.gpg ] then su pks -c "/usr/sbin/pksclient $pks_dir/db/ add \ /usr/share/keyrings/debian-keyring.pgp" > /dev/null || true fi # Tell debconf we are finished (see debconf-devel(8) to see why # we need this when running daemons from postinst). db_stop fi ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \'$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0