Skip to content

Commit

Permalink
debian: Delete log files correctly when packages are purged.
Browse files Browse the repository at this point in the history
Debian Policy 10.8 says "Log files should be removed when the package is
purged (but not when it is only removed)," but the Open vSwitch packages
didn't properly implement this:

   - The openvswitch-brcompat and openvswitch-pki packages didn't delete
     their log files at purge time.

   - The openvswitch-switch package deleted all of the log files at purge
     time, even those owned by openvswitch-brcompat or openvswitch-pki.

This commit fixes both problems.

CC: [email protected]
Reported-by: Andreas Beckmann <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
blp committed Jan 24, 2012
1 parent 1650ab6 commit e8b9516
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 1 deletion.
2 changes: 2 additions & 0 deletions debian/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ EXTRA_DIST += \
debian/openvswitch-brcompat.install \
debian/openvswitch-brcompat.manpages \
debian/openvswitch-brcompat.postinst \
debian/openvswitch-brcompat.postrm \
debian/openvswitch-common.dirs \
debian/openvswitch-common.install \
debian/openvswitch-common.manpages \
Expand All @@ -31,6 +32,7 @@ EXTRA_DIST += \
debian/openvswitch-ipsec.init \
debian/openvswitch-ipsec.install \
debian/openvswitch-pki.postinst \
debian/openvswitch-pki.postrm \
debian/openvswitch-switch.README.Debian \
debian/openvswitch-switch.dirs \
debian/openvswitch-switch.init \
Expand Down
43 changes: 43 additions & 0 deletions debian/openvswitch-brcompat.postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh
# postrm script for openvswitch-brcompat
#
# 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 http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
purge)
rm -f /var/log/openvswitch/ovs-brcompatd.log* || true
;;

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#

exit 0


43 changes: 43 additions & 0 deletions debian/openvswitch-pki.postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh
# postrm script for openvswitch-pki
#
# 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 http://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
purge)
rm -f /var/log/openvswitch/ovs-pki.log* || true
;;

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#

exit 0


3 changes: 2 additions & 1 deletion debian/openvswitch-switch.postrm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ case "$1" in
rm -f /etc/openvswitch/conf.db
rm -f /etc/openvswitch/.conf.db.~lock~
rm -f /etc/default/openvswitch-switch
rm -f /var/log/openvswitch/* || true
rm -f /var/log/openvswitch/ovs-vswitchd.log* || true
rm -f /var/log/openvswitch/ovsdb-server.log* || true
;;

remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
Expand Down

0 comments on commit e8b9516

Please sign in to comment.