Commit 332e2b64 authored by Michael Tokarev's avatar Michael Tokarev

Merge branch 'fix-1820291-freeze-hook-and-CVE-Debian' into 'debian-unstable'

qemu-guest-agent: fix path of fsfreeze-hook (LP: #1820291)

See merge request qemu-team/qemu!5
parents e1405346 0d03ac91
......@@ -3,4 +3,4 @@ debian/tmp/usr/share/man/man8/qemu-ga.8 /usr/share/man/man8
debian/tmp/usr/share/man/man7/qemu-ga-ref.7 /usr/share/man/man7
debian/tmp/usr/share/doc/qemu/qemu-ga-ref.* /usr/share/doc/qemu-guest-agent
qga/qapi-schema.json /usr/share/doc/qemu-guest-agent
scripts/qemu-guest-agent/fsfreeze-hook /etc/qemu/fsfreeze-hook
scripts/qemu-guest-agent/fsfreeze-hook /etc/qemu/
#!/bin/sh
# postinst script for qemu-guest-agent
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
# Normal mv_conffile alone would fail due to the new path being a DIR in the old package version (LP: 1820291)
case "$1" in
configure)
# From /usr/bin/dpkg-maintscript-helper modified to be able to cope with this edge case
if [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "1:3.1+dfsg-7~"; then
TMPCONFFILE="/etc/qemu/fsfreeze-hook.old"
NEWCONFFILE="/etc/qemu/fsfreeze-hook"
ORIGCONFFILE="/etc/qemu/fsfreeze-hook/fsfreeze-hook"
rm -f "$TMPCONFFILE.dpkg-remove"
if [ -e "$TMPCONFFILE" ]; then
echo "Preserving user changes to $NEWCONFFILE (renamed from $ORIGCONFFILE)..."
if [ -e "$NEWCONFFILE" ]; then
mv -f "$NEWCONFFILE" "$NEWCONFFILE.dpkg-new"
fi
mv -f "$TMPCONFFILE" "$NEWCONFFILE"
fi
fi
;;
esac
exit 0
#!/bin/sh
# postrm script for qemu-guest-agent
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
# If needed revert the move we have made in preinst to compensate the new path being a DIR in the old package version (LP: 1820291)
case "$1" in
abort-install|abort-upgrade)
# From /usr/bin/dpkg-maintscript-helper modified to be able to cope with this edge case
if [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "1:3.1+dfsg-7~"; then
TMPCONFFILE="/etc/qemu/fsfreeze-hook.old"
NEWCONFFILE="/etc/qemu/fsfreeze-hook"
ORIGCONFFILE="/etc/qemu/fsfreeze-hook/fsfreeze-hook"
if [ -e "$TMPCONFFILE.dpkg-remove" ]; then
echo "Reinstalling $ORIGCONFFILE that was moved away"
if [ -f "$NEWCONFFILE" ]; then
rm -f "$NEWCONFFILE"
fi
mkdir -p "$NEWCONFFILE"
mv "$TMPCONFFILE.dpkg-remove" "$ORIGCONFFILE"
fi
fi
esac
exit 0
#!/bin/sh
# preinst script for qemu-guest-agent
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
install|upgrade)
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# Normal mv_conffile alone would fail due to the new path being a DIR in the old package version (LP: 1820291)
case "$1" in
install|upgrade)
# From /usr/bin/dpkg-maintscript-helper modified to be able to cope with this edge case
if [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "1:3.1+dfsg-7~"; then
TMPCONFFILE="/etc/qemu/fsfreeze-hook.old"
NEWCONFFILE="/etc/qemu/fsfreeze-hook"
ORIGCONFFILE="/etc/qemu/fsfreeze-hook/fsfreeze-hook"
if [ -f "$ORIGCONFFILE" ]; then
disk_md5sum="$(md5sum "$ORIGCONFFILE" | sed -e 's/ .*//')"
pkg_md5sum="$(dpkg-query -W -f='${Conffiles}' "qemu-guest-agent" | \
sed -n -e "\'^ $ORIGCONFFILE ' { s/ obsolete$//; s/.* //; p }")"
if [ "$disk_md5sum" = "$pkg_md5sum" ]; then
# mark as having no custom content
mv -f "$ORIGCONFFILE" "${TMPCONFFILE}.dpkg-remove"
else
# keep the "old" name to reflect there is content to be preserved
mv -f "$ORIGCONFFILE" "$TMPCONFFILE"
fi
# In any case the old directory blocking the new conffile
# has to be removed before unpack happens
rmdir "$NEWCONFFILE" || echo "failed to remove $NEWCONFFILE"
fi
fi
;;
esac
#DEBHELPER#
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment