diff options
| author | Colin Watson <cjwatson@debian.org> | 2013-05-21 22:41:23 (GMT) |
|---|---|---|
| committer | Colin Watson <cjwatson@debian.org> | 2013-05-21 22:41:23 (GMT) |
| commit | 1fa04ebf122aec5ecbbdb6c7e001665b238e4c62 (patch) | |
| tree | 3d228c46959931802ddcc289bd658ccda5ab4738 | |
| parent | cc7c64fe532ac804ce6c65d701a32b614cc0b26a (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.
| -rw-r--r-- | debian/changelog | 5 | ||||
| -rw-r--r-- | debian/openssh-client.postinst | 9 | ||||
| -rw-r--r-- | debian/openssh-client.postrm | 13 | ||||
| -rw-r--r-- | debian/openssh-client.preinst | 49 | ||||
| -rw-r--r-- | debian/openssh-server.postinst.in | 10 | ||||
| -rw-r--r-- | debian/openssh-server.postrm | 12 | ||||
| -rw-r--r-- | debian/openssh-server.preinst | 40 | ||||
| -rwxr-xr-x | debian/rules | 11 | ||||
| -rw-r--r-- | debian/substitute-conffile.pl | 26 |
9 files changed, 5 insertions, 170 deletions
diff --git a/debian/changelog b/debian/changelog index 07aeeb4..c1ada94 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,11 @@ openssh (1:6.2p2-2) UNRELEASED; urgency=low is not really necessary since one of static-network-up and failsafe-boot is guaranteed to happen and will trigger entry to the default runlevel, and we don't care about ssh starting before the network (LP: #1098299). + * 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. -- Colin Watson <cjwatson@debian.org> Tue, 21 May 2013 17:49:35 +0100 diff --git a/debian/openssh-client.postinst b/debian/openssh-client.postinst index cff282d..2f884b7 100644 --- a/debian/openssh-client.postinst +++ b/debian/openssh-client.postinst @@ -94,13 +94,6 @@ set_ssh_agent_permissions() { fi } -commit_transfer_conffile () { - CONFFILE="$1" - if [ -e "$CONFFILE.moved-by-preinst" ]; then - rm -f "$CONFFILE.moved-by-preinst" - fi -} - fix_rsh_diversion create_alternatives @@ -109,7 +102,5 @@ if [ "$2" = "1:3.5p1-1" ]; then fix_ssh_group fi set_ssh_agent_permissions -commit_transfer_conffile /etc/ssh/moduli -commit_transfer_conffile /etc/ssh/ssh_config exit 0 diff --git a/debian/openssh-client.postrm b/debian/openssh-client.postrm index eb6fde0..2b29a09 100644 --- a/debian/openssh-client.postrm +++ b/debian/openssh-client.postrm @@ -2,20 +2,7 @@ #DEBHELPER# -abort_transfer_conffile () { - CONFFILE="$1" - if [ -e "$CONFFILE.moved-by-preinst" ]; then - echo >&2 "Aborting ownership transfer of conffile $CONFFILE ..." - mv -f "$CONFFILE.moved-by-preinst" "$CONFFILE" - return 0 - fi -} - case $1 in - abort-install|abort-upgrade) - abort_transfer_conffile /etc/ssh/moduli - abort_transfer_conffile /etc/ssh/ssh_config - ;; purge) # Remove all non-conffiles that ssh might create, so that we # can smoothly remove /etc/ssh if and only if the user diff --git a/debian/openssh-client.preinst b/debian/openssh-client.preinst deleted file mode 100644 index 0b29c05..0000000 --- a/debian/openssh-client.preinst +++ /dev/null @@ -1,49 +0,0 @@ -#! /bin/sh -e - -ETC_SSH_MODULI=@ETC_SSH_MODULI@ - -ETC_SSH_SSH_CONFIG=@ETC_SSH_SSH_CONFIG@ - -action="$1" -version="$2" - -prepare_transfer_conffile () { - CONFFILE="$1" - TEXT="$2" - MODE="$3" - [ "$CONFFILES" ] || return 0 - [ -e "$CONFFILE" ] || return 0 - - md5sum="$(md5sum "$CONFFILE" |sed -e 's/ .*//')" - old_md5sum="$(echo "$CONFFILES" | awk '$1 == "'"$CONFFILE"'" { print $2 }')" - if [ "$md5sum" = "$old_md5sum" ]; then - echo >&2 "Transferring ownership of conffile $CONFFILE ..." - # We have to write out the desired new text of the conffile, - # which is tricky in the preinst, hence the nasty way we - # have to hardcode the text here. Fortunately, this is only - # necessary with sarge's dpkg and older. - if echo "$TEXT" | head -n1 | grep -q '^@.*@$'; then - echo >&2 'Unsubstituted conffile text! Please report this bug.' - exit 1 - fi - printf '%s' "$TEXT" >"$CONFFILE.dpkg-new" - chmod "$MODE" "$CONFFILE.dpkg-new" - mv -f "$CONFFILE" "$CONFFILE.moved-by-preinst" - mv -f "$CONFFILE.dpkg-new" "$CONFFILE" - return 0 - fi -} - -case $action in - install|upgrade) - if dpkg --compare-versions "$version" lt 0; then - CONFFILES="$(dpkg-query -W -f '${Conffiles}\n' ssh 2>/dev/null | sed 's/^ *//')" - prepare_transfer_conffile /etc/ssh/moduli "$ETC_SSH_MODULI" 0644 - prepare_transfer_conffile /etc/ssh/ssh_config "$ETC_SSH_SSH_CONFIG" 0644 - fi - ;; -esac - -#DEBHELPER# - -exit 0 diff --git a/debian/openssh-server.postinst.in b/debian/openssh-server.postinst.in index 9aa5682..9869c9b 100644 --- a/debian/openssh-server.postinst.in +++ b/debian/openssh-server.postinst.in @@ -440,13 +440,6 @@ setup_init() { esac } -commit_transfer_conffile () { - CONFFILE="$1" - if [ -e "$CONFFILE.moved-by-preinst" ]; then - rm -f "$CONFFILE.moved-by-preinst" - fi -} - commit_mv_conffile () { OLDCONFFILE="$1" NEWCONFFILE="$2" @@ -477,9 +470,6 @@ if dpkg --compare-versions "$2" lt 1:5.2p1-1; then remove_old_init_links fi setup_init -commit_transfer_conffile /etc/default/ssh -commit_transfer_conffile /etc/init.d/ssh -commit_transfer_conffile /etc/pam.d/ssh commit_mv_conffile /etc/pam.d/ssh /etc/pam.d/sshd # Renamed to /etc/ssh/moduli in 2.9.9 (!) if dpkg --compare-versions "$2" lt 1:4.7p1-1; then diff --git a/debian/openssh-server.postrm b/debian/openssh-server.postrm index 655c1ae..bc55df1 100644 --- a/debian/openssh-server.postrm +++ b/debian/openssh-server.postrm @@ -22,23 +22,11 @@ finish_mv_conffile () { fi } -abort_transfer_conffile () { - CONFFILE="$1" - if [ -e "$CONFFILE.moved-by-preinst" ]; then - echo >&2 "Aborting ownership transfer of conffile $CONFFILE ..." - mv -f "$CONFFILE.moved-by-preinst" "$CONFFILE" - return 0 - fi -} - case $1 in abort-install|abort-upgrade) if dpkg --compare-versions "$2" lt 1:4.7p1-4; then abort_mv_conffile /etc/pam.d/ssh fi - abort_transfer_conffile /etc/default/ssh - abort_transfer_conffile /etc/init.d/ssh - abort_transfer_conffile /etc/pam.d/ssh ;; purge) # Remove all non-conffiles that ssh might create, so that we diff --git a/debian/openssh-server.preinst b/debian/openssh-server.preinst index 5100706..9f3fa05 100644 --- a/debian/openssh-server.preinst +++ b/debian/openssh-server.preinst @@ -1,41 +1,8 @@ #!/bin/sh -e -ETC_DEFAULT_SSH=@ETC_DEFAULT_SSH@ - -ETC_INIT_D_SSH=@ETC_INIT_D_SSH@ - -ETC_PAM_D_SSH=@ETC_PAM_D_SSH@ - action=$1 version=$2 -prepare_transfer_conffile () { - CONFFILE="$1" - TEXT="$2" - MODE="$3" - [ "$CONFFILES" ] || return 0 - [ -e "$CONFFILE" ] || return 0 - - md5sum="$(md5sum "$CONFFILE" |sed -e 's/ .*//')" - old_md5sum="$(echo "$CONFFILES" | awk '$1 == "'"$CONFFILE"'" { print $2 }')" - if [ "$md5sum" = "$old_md5sum" ]; then - echo >&2 "Transferring ownership of conffile $CONFFILE ..." - # We have to write out the desired new text of the conffile, - # which is tricky in the preinst, hence the nasty way we - # have to hardcode the text here. Fortunately, this is only - # necessary with sarge's dpkg and older. - if echo "$TEXT" | head -n1 | grep -q '^@.*@$'; then - echo >&2 'Unsubstituted conffile text! Please report this bug.' - exit 1 - fi - printf '%s' "$TEXT" >"$CONFFILE.dpkg-new" - chmod "$MODE" "$CONFFILE.dpkg-new" - mv -f "$CONFFILE" "$CONFFILE.moved-by-preinst" - mv -f "$CONFFILE.dpkg-new" "$CONFFILE" - return 0 - fi -} - prepare_mv_conffile () { CONFFILE="$1" [ -e "$CONFFILE" ] || return 0 @@ -124,13 +91,6 @@ EOF } fi - if dpkg --compare-versions "$version" lt 0; then - CONFFILES="$(dpkg-query -W -f '${Conffiles}\n' ssh 2>/dev/null | sed 's/^ *//')" - prepare_transfer_conffile /etc/default/ssh "$ETC_DEFAULT_SSH" 0644 - prepare_transfer_conffile /etc/init.d/ssh "$ETC_INIT_D_SSH" 0755 - prepare_transfer_conffile /etc/pam.d/ssh "$ETC_PAM_D_SSH" 0644 - fi - if dpkg --compare-versions "$version" lt 1:4.7p1-4; then prepare_mv_conffile /etc/pam.d/ssh fi diff --git a/debian/rules b/debian/rules index db7f81f..c78653b 100755 --- a/debian/rules +++ b/debian/rules @@ -219,17 +219,6 @@ override_dh_shlibdeps: override_dh_installdeb: $(DISTRIBUTOR_REPLACE) dh_installdeb - perl -i debian/substitute-conffile.pl \ - ETC_SSH_MODULI debian/openssh-client/etc/ssh/moduli \ - ETC_SSH_SSH_CONFIG debian/openssh-client/etc/ssh/ssh_config \ - debian/openssh-client/DEBIAN/preinst - # Yes, ETC_PAM_D_SSH is meant to be spelled that way, to match the - # old configuration file name we need to transfer. - perl -i debian/substitute-conffile.pl \ - ETC_DEFAULT_SSH debian/openssh-server/etc/default/ssh \ - ETC_INIT_D_SSH debian/openssh-server/etc/init.d/ssh \ - ETC_PAM_D_SSH debian/openssh-server/etc/pam.d/sshd \ - debian/openssh-server/DEBIAN/preinst override_dh_gencontrol: dh_gencontrol -- -V'openssh-server:Recommends=$(server_recommends)' diff --git a/debian/substitute-conffile.pl b/debian/substitute-conffile.pl deleted file mode 100644 index 7dd2336..0000000 --- a/debian/substitute-conffile.pl +++ /dev/null @@ -1,26 +0,0 @@ -#! /usr/bin/perl -p - -# This is needed for a nasty preinst hack to work around a bug in sarge's -# version of dpkg. It substitutes the literal text of conffiles into preinst -# scripts so that they can be used when moving conffiles between packages. - -BEGIN { - %texts = (); - while (@ARGV > 1) { - my $name = $ARGV[0]; - shift; - local *FILE; - open FILE, '<', $ARGV[0]; - local $/ = undef; - my $text = <FILE>; - close FILE; - # Quote for the shell. - $text =~ s/'/'\\''/g; - shift; - $texts{$name} = $text; - } -} - -for my $name (keys %texts) { - s/\@$name\@/'$texts{$name}'/g; -} |
