Skip to content

Commit

Permalink
package/systemd: always delete hwdb
Browse files Browse the repository at this point in the history
Up to now, the source files of the hwdb was only cleaned if systemd-hwdb
was used. However, those files should only be used by the hwdb anyway --
otherwise we shouldn't clean them even when the hwdb is enabled.
Therefore, remove them even if hwdb is disabled.

hwdb files can be put in two places: /usr/lib/udev, or /etc/udev. The
former is where systemd-compliant packages would install them, but the
latter is where they were originally placed. In systemd-land, /etc
should only contain local information, so ideally it should be empty in
the rootfs.

The reality, however, is that many packages still install files in /etc.
Thus, there are probably also packages that install hwdb files in
/etc/udev.

Therefore, clean the hwdb files both in /etc/udev and in /usr/lib/udev.

Probably, we should do this cleaning even when systemd is not selected,
since non-systemd packages may install files there which are not
relevant without systemd-hwdb (or eudev). However, that's a bigger
change which needs a separate patch (and a bit more consideration).

While we're at it, get rid of the HOST_EUDEV_SYSCONFDIR variable. This
is a leftover from when udev was still extracted from the systemd
package (i.e. before eudev became a separate package).

Signed-off-by: Norbert Lange <[email protected]>
[Arnout: split in two separate commits]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
  • Loading branch information
nolange authored and arnout committed Jul 28, 2022
1 parent 1532252 commit 8a1e8cd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions package/systemd/systemd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,6 @@ define SYSTEMD_BUILD_HWDB
$(HOST_DIR)/bin/systemd-hwdb update --root $(TARGET_DIR) --strict --usr
endef
SYSTEMD_TARGET_FINALIZE_HOOKS += SYSTEMD_BUILD_HWDB
define SYSTEMD_RM_HWDB_SRV
rm -rf $(TARGET_DIR)/$(HOST_EUDEV_SYSCONFDIR)/udev/hwdb.d/
endef
SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_RM_HWDB_SRV
else
SYSTEMD_CONF_OPTS += -Dhwdb=false
endif
Expand Down Expand Up @@ -730,6 +726,11 @@ endef
SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_UPDATE_CATALOGS
endif

define SYSTEMD_RM_HWDB_DATA
rm -rf $(TARGET_DIR)/usr/lib/udev/hwdb.d/ $(TARGET_DIR)/etc/udev/hwdb.d/
endef
SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_RM_HWDB_DATA

define SYSTEMD_RM_CATALOG_UPDATE_SERVICE
rm -rf $(TARGET_DIR)/usr/lib/systemd/catalog \
$(TARGET_DIR)/usr/lib/systemd/system/systemd-journal-catalog-update.service \
Expand Down

0 comments on commit 8a1e8cd

Please sign in to comment.