summaryrefslogtreecommitdiff
path: root/debian/openssh-client.preinst
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2006-12-06 21:55:19 +0000
committerColin Watson <cjwatson@debian.org>2006-12-06 21:55:19 +0000
commite2f4fb43875e216cbcf7cabbb621ecb205c24857 (patch)
tree65aac6efdb62456154277787f5fdf4e718997684 /debian/openssh-client.preinst
parentd23e75730cfd617b7638e3b8013e3e1f3a1ecce9 (diff)
* 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).
Diffstat (limited to 'debian/openssh-client.preinst')
-rw-r--r--debian/openssh-client.preinst30
1 files changed, 30 insertions, 0 deletions
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 @@
1#! /bin/sh -e
2
3action="$1"
4version="$2"
5
6prepare_transfer_conffile () {
7 CONFFILE="$1"
8 [ -e "$CONFFILE" ] || return 0
9
10 md5sum="$(md5sum "$CONFFILE" |sed -e 's/ .*//')"
11 old_md5sum="$(sed -n -e "/^Conffiles:/,/^[^ ]/{\\' $CONFFILE'{s/^ [^ ]* //;s/ .*//;p}}" /var/lib/dpkg/status)"
12 if [ "$md5sum" = "$old_md5sum" ]; then
13 echo >&2 "Transferring ownership of conffile $CONFFILE ..."
14 mv -f "$CONFFILE" "$CONFFILE.moved-by-preinst"
15 return 0
16 fi
17}
18
19case $action in
20 install|upgrade)
21 if dpkg --compare-versions "$version" lt 0; then
22 prepare_transfer_conffile /etc/ssh/moduli
23 prepare_transfer_conffile /etc/ssh/ssh_config
24 fi
25 ;;
26esac
27
28#DEBHELPER#
29
30exit 0