piuparts doesn't like seeing an empty resolv.conf after removing
the package, so take a backup and use it in case resolved/resolv.conf
is not available
dpkg refuses to install the symlink in chroot/container environments
where /etc/resolv.conf is bind mounted:
| Unpacking systemd-resolved (251.4-1) ...
| dpkg: error processing archive /var/cache/apt/archives/systemd-resolved_251.4-1_amd64.deb (--unpack):
| unable to make backup link of './etc/resolv.conf' before installing new version: Invalid cross-device link
So unfortunately manual handling via maintainerscripts is necessary.
Use maintainer scripts to avoid failing the installation, and provide
feedback to the user if the symlink cannot be successfully installed.
Also on removal, either copy /run/systemd/resolve/resolv.conf or
create an empty /etc/resolv.conf.