Web lists-archives.com

regex in apt preferences

In my saga of limiting the damage from remnents of systemd, I'm focusing in on libsystemd0. I want to allow only libsystemd0 to be upgradable and forbid the installation and/or upgrading of anything else matching *systemd*.

Here's what I did so far:

Following http://without-systemd.org/wiki/index.php/Debian_Stretch, it suggests adding this entry for /etc/apt/preferences.d/systemd:

Package: *systemd*
Pin: release *
Pin-Priority: -1

This will prevent anything requiring systemd from being accidentally installed. This also prevents libsystemd0 from being updated. While I understand now that it's okay to leave it installed, not updating it bothers me. It has also resulted in a lot of confusion over apt-get(8)'s response of "1 not upgraded". So, I want to explicitly allow libsystemd0 to be upgraded. According to the apt_preferences(5) manpage in section "Regular expressions and glob(7) syntax", it seems to me that if I add a specific rule after the above rule, then libsystemd0 should be allowed yet other systemd stuff should be forbidden. For instance:

Package: libsystemd0
Pin: release *
Pin-Priority: 1001

But that doesn't work.  All packages including libsystemd0 are blocked.

Then I tried a single entry and a regex like this on the "Package:":
	/((?!.*libsystemd0).*systemd.*)/g or

Neither of these blocked anything.

David Griffith

A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?