summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2007-06-04 22:12:52 +0000
committerColin Watson <cjwatson@debian.org>2007-06-04 22:12:52 +0000
commit9caa28600a47cc37031251eb77841861ca0c0eaa (patch)
treebb2e53022aec14b9476b744b056d62138d12cb24
parentfd986eabedb1a25e3a90c9055d55801f681b3739 (diff)
* Use dpkg-query to fetch conffile md5sums rather than parsing
/var/lib/dpkg/status directly.
-rw-r--r--debian/changelog2
-rw-r--r--debian/openssh-client.preinst4
-rw-r--r--debian/openssh-server.preinst4
3 files changed, 8 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 8ed60f77e..69b408900 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ openssh (1:4.3p2-11) UNRELEASED; urgency=low
4 maintainer, so the Maintainer field is getting a bit inaccurate. Set 4 maintainer, so the Maintainer field is getting a bit inaccurate. Set
5 Maintainer to debian-ssh@lists.debian.org and leave Matthew and myself 5 Maintainer to debian-ssh@lists.debian.org and leave Matthew and myself
6 as Uploaders. 6 as Uploaders.
7 * Use dpkg-query to fetch conffile md5sums rather than parsing
8 /var/lib/dpkg/status directly.
7 * Apply results of debconf templates and package descriptions review by 9 * Apply results of debconf templates and package descriptions review by
8 debian-l10n-english (closes: #420107). 10 debian-l10n-english (closes: #420107).
9 * debconf template translations: 11 * debconf template translations:
diff --git a/debian/openssh-client.preinst b/debian/openssh-client.preinst
index 9cf29dfba..fd55a53bd 100644
--- a/debian/openssh-client.preinst
+++ b/debian/openssh-client.preinst
@@ -11,10 +11,11 @@ prepare_transfer_conffile () {
11 CONFFILE="$1" 11 CONFFILE="$1"
12 TEXT="$2" 12 TEXT="$2"
13 MODE="$3" 13 MODE="$3"
14 [ "$CONFFILES" ] || return 0
14 [ -e "$CONFFILE" ] || return 0 15 [ -e "$CONFFILE" ] || return 0
15 16
16 md5sum="$(md5sum "$CONFFILE" |sed -e 's/ .*//')" 17 md5sum="$(md5sum "$CONFFILE" |sed -e 's/ .*//')"
17 old_md5sum="$(sed -n -e "/^Conffiles:/,/^[^ ]/{\\' $CONFFILE'{s/^ [^ ]* //;s/ .*//;p}}" /var/lib/dpkg/status)" 18 old_md5sum="$(echo "$CONFFILES" | awk '$1 == "'"$CONFFILE"'" { print $2 }')"
18 if [ "$md5sum" = "$old_md5sum" ]; then 19 if [ "$md5sum" = "$old_md5sum" ]; then
19 echo >&2 "Transferring ownership of conffile $CONFFILE ..." 20 echo >&2 "Transferring ownership of conffile $CONFFILE ..."
20 # We have to write out the desired new text of the conffile, 21 # We have to write out the desired new text of the conffile,
@@ -36,6 +37,7 @@ prepare_transfer_conffile () {
36case $action in 37case $action in
37 install|upgrade) 38 install|upgrade)
38 if dpkg --compare-versions "$version" lt 0; then 39 if dpkg --compare-versions "$version" lt 0; then
40 CONFFILES="$(dpkg-query -W -f '${Conffiles}\n' ssh | sed 's/^ *//')"
39 prepare_transfer_conffile /etc/ssh/moduli "$ETC_SSH_MODULI" 0644 41 prepare_transfer_conffile /etc/ssh/moduli "$ETC_SSH_MODULI" 0644
40 prepare_transfer_conffile /etc/ssh/ssh_config "$ETC_SSH_SSH_CONFIG" 0644 42 prepare_transfer_conffile /etc/ssh/ssh_config "$ETC_SSH_SSH_CONFIG" 0644
41 fi 43 fi
diff --git a/debian/openssh-server.preinst b/debian/openssh-server.preinst
index 2c2e2687c..866cf8b1a 100644
--- a/debian/openssh-server.preinst
+++ b/debian/openssh-server.preinst
@@ -13,10 +13,11 @@ prepare_transfer_conffile () {
13 CONFFILE="$1" 13 CONFFILE="$1"
14 TEXT="$2" 14 TEXT="$2"
15 MODE="$3" 15 MODE="$3"
16 [ "$CONFFILES" ] || return 0
16 [ -e "$CONFFILE" ] || return 0 17 [ -e "$CONFFILE" ] || return 0
17 18
18 md5sum="$(md5sum "$CONFFILE" |sed -e 's/ .*//')" 19 md5sum="$(md5sum "$CONFFILE" |sed -e 's/ .*//')"
19 old_md5sum="$(sed -n -e "/^Conffiles:/,/^[^ ]/{\\' $CONFFILE'{s/^ [^ ]* //;s/ .*//;p}}" /var/lib/dpkg/status)" 20 old_md5sum="$(echo "$CONFFILES" | awk '$1 == "'"$CONFFILE"'" { print $2 }')"
20 if [ "$md5sum" = "$old_md5sum" ]; then 21 if [ "$md5sum" = "$old_md5sum" ]; then
21 echo >&2 "Transferring ownership of conffile $CONFFILE ..." 22 echo >&2 "Transferring ownership of conffile $CONFFILE ..."
22 # We have to write out the desired new text of the conffile, 23 # We have to write out the desired new text of the conffile,
@@ -111,6 +112,7 @@ EOF
111 fi 112 fi
112 113
113 if dpkg --compare-versions "$version" lt 0; then 114 if dpkg --compare-versions "$version" lt 0; then
115 CONFFILES="$(dpkg-query -W -f '${Conffiles}\n' ssh | sed 's/^ *//')"
114 prepare_transfer_conffile /etc/default/ssh "$ETC_DEFAULT_SSH" 0644 116 prepare_transfer_conffile /etc/default/ssh "$ETC_DEFAULT_SSH" 0644
115 prepare_transfer_conffile /etc/init.d/ssh "$ETC_INIT_D_SSH" 0755 117 prepare_transfer_conffile /etc/init.d/ssh "$ETC_INIT_D_SSH" 0755
116 prepare_transfer_conffile /etc/pam.d/ssh "$ETC_PAM_D_SSH" 0644 118 prepare_transfer_conffile /etc/pam.d/ssh "$ETC_PAM_D_SSH" 0644