summaryrefslogtreecommitdiff
path: root/debian/openssh-server.preinst
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2013-05-21 23:41:23 +0100
committerColin Watson <cjwatson@debian.org>2013-05-21 23:41:23 +0100
commit1fa04ebf122aec5ecbbdb6c7e001665b238e4c62 (patch)
tree3d228c46959931802ddcc289bd658ccda5ab4738 /debian/openssh-server.preinst
parentcc7c64fe532ac804ce6c65d701a32b614cc0b26a (diff)
Drop conffile handling for upgrades from pre-split ssh package; this was
originally added in 1:4.3p2-7 / 1:4.3p2-8, and contained a truly ghastly hack around a misbehaviour in sarge's dpkg. Since this is now four Debian releases ago, we can afford to drop this and simplify the packaging.
Diffstat (limited to 'debian/openssh-server.preinst')
-rw-r--r--debian/openssh-server.preinst40
1 files changed, 0 insertions, 40 deletions
diff --git a/debian/openssh-server.preinst b/debian/openssh-server.preinst
index 510070645..9f3fa05ed 100644
--- a/debian/openssh-server.preinst
+++ b/debian/openssh-server.preinst
@@ -1,41 +1,8 @@
1#!/bin/sh -e 1#!/bin/sh -e
2 2
3ETC_DEFAULT_SSH=@ETC_DEFAULT_SSH@
4
5ETC_INIT_D_SSH=@ETC_INIT_D_SSH@
6
7ETC_PAM_D_SSH=@ETC_PAM_D_SSH@
8
9action=$1 3action=$1
10version=$2 4version=$2
11 5
12prepare_transfer_conffile () {
13 CONFFILE="$1"
14 TEXT="$2"
15 MODE="$3"
16 [ "$CONFFILES" ] || return 0
17 [ -e "$CONFFILE" ] || return 0
18
19 md5sum="$(md5sum "$CONFFILE" |sed -e 's/ .*//')"
20 old_md5sum="$(echo "$CONFFILES" | awk '$1 == "'"$CONFFILE"'" { print $2 }')"
21 if [ "$md5sum" = "$old_md5sum" ]; then
22 echo >&2 "Transferring ownership of conffile $CONFFILE ..."
23 # We have to write out the desired new text of the conffile,
24 # which is tricky in the preinst, hence the nasty way we
25 # have to hardcode the text here. Fortunately, this is only
26 # necessary with sarge's dpkg and older.
27 if echo "$TEXT" | head -n1 | grep -q '^@.*@$'; then
28 echo >&2 'Unsubstituted conffile text! Please report this bug.'
29 exit 1
30 fi
31 printf '%s' "$TEXT" >"$CONFFILE.dpkg-new"
32 chmod "$MODE" "$CONFFILE.dpkg-new"
33 mv -f "$CONFFILE" "$CONFFILE.moved-by-preinst"
34 mv -f "$CONFFILE.dpkg-new" "$CONFFILE"
35 return 0
36 fi
37}
38
39prepare_mv_conffile () { 6prepare_mv_conffile () {
40 CONFFILE="$1" 7 CONFFILE="$1"
41 [ -e "$CONFFILE" ] || return 0 8 [ -e "$CONFFILE" ] || return 0
@@ -124,13 +91,6 @@ EOF
124 } 91 }
125 fi 92 fi
126 93
127 if dpkg --compare-versions "$version" lt 0; then
128 CONFFILES="$(dpkg-query -W -f '${Conffiles}\n' ssh 2>/dev/null | sed 's/^ *//')"
129 prepare_transfer_conffile /etc/default/ssh "$ETC_DEFAULT_SSH" 0644
130 prepare_transfer_conffile /etc/init.d/ssh "$ETC_INIT_D_SSH" 0755
131 prepare_transfer_conffile /etc/pam.d/ssh "$ETC_PAM_D_SSH" 0644
132 fi
133
134 if dpkg --compare-versions "$version" lt 1:4.7p1-4; then 94 if dpkg --compare-versions "$version" lt 1:4.7p1-4; then
135 prepare_mv_conffile /etc/pam.d/ssh 95 prepare_mv_conffile /etc/pam.d/ssh
136 fi 96 fi