Ok, this got interesting, and hopefully not too complicated. I force-pushed because I had many iterations that would look ugly, but basically the changes are:
- use apparmor_parser -W -T flags, just like dh_apparmor does when updating a package that ships a profile (do a "grep apparmor_parser /var/lib/dpkg/info/*.postinst" to see). This avoids the apparmor cache
- use a trap, as discussed
- backup the original override. We shouldn't have a package shipping an apparmor override file with actual content, but let's play nice
- use set -x
Ok, this got interesting, and hopefully not too complicated. I force-pushed because I had many iterations that would look ugly, but basically the changes are: dpkg/info/ *.postinst" to see). This avoids the apparmor cache
- use apparmor_parser -W -T flags, just like dh_apparmor does when updating a package that ships a profile (do a "grep apparmor_parser /var/lib/
- use a trap, as discussed
- backup the original override. We shouldn't have a package shipping an apparmor override file with actual content, but let's play nice
- use set -x
Please take another look, thanks!