#!/bin/sh

action=$1
version=$2

# Source debconf library.
. /usr/share/debconf/confmodule
db_version 2.0

if [ -d /etc/ssh-nonfree ] && [ ! -d /etc/ssh ]; then
  version=1.2.27
  cp -a /etc/ssh-nonfree /etc/ssh
fi

# Was ssh-keysign's setuid bit turned off using the obsolete debconf
# question? If so, turn this into a statoverride. (Ugh.)
if dpkg --compare-versions "$2" lt 1:4.1p1-2 && \
    db_get ssh/SUID_client && [ "$RET" = false ] &&
    [ -x /usr/sbin/dpkg-statoverride ] && \
    ! dpkg-statoverride --list /usr/lib/ssh-keysign && \
    ! dpkg-statoverride --list /usr/lib/openssh/ssh-keysign; then
	dpkg-statoverride --update --add root root 0755 \
		/usr/lib/openssh/ssh-keysign
fi

exit 0
