From 4c7acded2ace6fc074b80f098ee3754de758eab7 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Dec 13 2023 12:02:45 +0000 Subject: Do not remove modified config files Our config files in /etc/ were marked as %config(noreplace). This means that the would not be replaced on upgraded if local modifications have been made. But when we moved them to /usr/lib, they would be be renamed to .rpmsave, if they had local modifications. This is not what I expected, but what rpm apparently does. So we need to add them as %ghost to prevent the removal. This is probably for the better anyway. --- diff --git a/split-files.py b/split-files.py index a595392..3f66ada 100644 --- a/split-files.py +++ b/split-files.py @@ -240,17 +240,18 @@ for file in files(buildroot): o = outputs['main'] if n in known_files: - prefix = ' '.join(known_files[n].split()[:-1]) - if prefix: - prefix += ' ' + prefix = known_files[n].split()[:-1] elif file.is_dir() and not file.is_symlink(): - prefix = '%dir ' + prefix = ['%dir'] elif 'README' in n: - prefix = '%doc ' + prefix = ['%doc'] elif n.startswith('/etc'): - prefix = '%config(noreplace) ' + prefix = ['%config(noreplace)'] + if file.stat().st_size == 0: + prefix += ['%ghost'] else: - prefix = '' + prefix = [] + prefix = ' '.join(prefix + ['']) if prefix else '' suffix = '*' if '/man/' in n else '' diff --git a/systemd.spec b/systemd.spec index a8946de..070190b 100644 --- a/systemd.spec +++ b/systemd.spec @@ -731,6 +731,25 @@ ln -sf ../bin/udevadm %{buildroot}%{_sbindir}/udevadm touch %{buildroot}/etc/crypttab chmod 600 %{buildroot}/etc/crypttab +# Config files that were moved under /usr. +# We need to %ghost them so that they are not removed on upgrades. +touch %{buildroot}/etc/systemd/coredump.conf \ + %{buildroot}/etc/systemd/homed.conf \ + %{buildroot}/etc/systemd/journald.conf \ + %{buildroot}/etc/systemd/journal-remote.conf \ + %{buildroot}/etc/systemd/journal-upload.conf \ + %{buildroot}/etc/systemd/logind.conf \ + %{buildroot}/etc/systemd/networkd.conf \ + %{buildroot}/etc/systemd/oomd.conf \ + %{buildroot}/etc/systemd/pstore.conf \ + %{buildroot}/etc/systemd/resolved.conf \ + %{buildroot}/etc/systemd/sleep.conf \ + %{buildroot}/etc/systemd/system.conf \ + %{buildroot}/etc/systemd/timesyncd.conf \ + %{buildroot}/etc/systemd/user.conf \ + %{buildroot}/etc/udev/udev.conf \ + %{buildroot}/etc/udev/iocost.conf + # /etc/initab install -Dm0644 -t %{buildroot}/etc/ %{SOURCE5}