From e2f4fb43875e216cbcf7cabbb621ecb205c24857 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 6 Dec 2006 21:55:19 +0000 Subject: * When installing openssh-client or openssh-server from scratch, remove any unchanged conffiles from the pre-split ssh package to work around a bug in sarge's dpkg (thanks, Justin Pryzby and others; closes: #335276). --- debian/openssh-client.preinst | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 debian/openssh-client.preinst (limited to 'debian/openssh-client.preinst') diff --git a/debian/openssh-client.preinst b/debian/openssh-client.preinst new file mode 100644 index 000000000..0e200712e --- /dev/null +++ b/debian/openssh-client.preinst @@ -0,0 +1,30 @@ +#! /bin/sh -e + +action="$1" +version="$2" + +prepare_transfer_conffile () { + CONFFILE="$1" + [ -e "$CONFFILE" ] || return 0 + + md5sum="$(md5sum "$CONFFILE" |sed -e 's/ .*//')" + old_md5sum="$(sed -n -e "/^Conffiles:/,/^[^ ]/{\\' $CONFFILE'{s/^ [^ ]* //;s/ .*//;p}}" /var/lib/dpkg/status)" + if [ "$md5sum" = "$old_md5sum" ]; then + echo >&2 "Transferring ownership of conffile $CONFFILE ..." + mv -f "$CONFFILE" "$CONFFILE.moved-by-preinst" + return 0 + fi +} + +case $action in + install|upgrade) + if dpkg --compare-versions "$version" lt 0; then + prepare_transfer_conffile /etc/ssh/moduli + prepare_transfer_conffile /etc/ssh/ssh_config + fi + ;; +esac + +#DEBHELPER# + +exit 0 -- cgit v1.2.3