diff options
Diffstat (limited to 'debian/openssh-server.preinst')
-rw-r--r-- | debian/openssh-server.preinst | 40 |
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 | ||
3 | ETC_DEFAULT_SSH=@ETC_DEFAULT_SSH@ | ||
4 | |||
5 | ETC_INIT_D_SSH=@ETC_INIT_D_SSH@ | ||
6 | |||
7 | ETC_PAM_D_SSH=@ETC_PAM_D_SSH@ | ||
8 | |||
9 | action=$1 | 3 | action=$1 |
10 | version=$2 | 4 | version=$2 |
11 | 5 | ||
12 | prepare_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 | |||
39 | prepare_mv_conffile () { | 6 | prepare_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 |