Thanks Jamie,
I wanted to make sure there is no easier "yeah it works that way".

I tested various combinations and I'm happy with using a normal
rm_conffile plus the following snippet in postinst "configure":

# transition from packaged to dh_apparmor generated local aa includes
# all other cases (no delta rm, abort, ...) are handled by rm_conffile
# can be dropped >18.04
if [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "3.5.0-1ubuntu1~"; then
    for CONFFILE in /etc/apparmor.d/local/usr.sbin.libvirtd 
/etc/apparmor.d/local/usr.lib.libvirt.virt-aa-helper; do
        if [ -e "$CONFFILE.dpkg-backup" ]; then
            echo "Obsolete conffile $CONFFILE has been modified by you."
            echo "These local includes are now generated by dh_apparmor"
            echo "Carrying over your changes into $CONFFILE ..."
            mv -f "$CONFFILE.dpkg-backup" "$CONFFILE"
        fi
    done
fi

This has the nice benefit that checksum comparison, abort, and much more will 
be done by dpkg_maintsscript_helper still.
Only the one special case where it would on finish_rm_conffile have made it a 
backup is thereby overruled and becomes this special "move over target".
dh_apparmor was so kind to not complain about that later on and keep it as-is 
(as it always does as it only "fills" missing local includes.
The tracking in dpkg status is also correctly updated (no more listed as 
obsolete)

I'll consider the bug done and mark it as not a bug (=invalid), this
update was mostly for documentation purpose.

** Changed in: apparmor (Ubuntu)
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1703763

Title:
  How to correctly transition from packaged to dh_apparmor generated
  local includes

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1703763/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to