From 155078c835a00fed264a7b36b06f709d9b57cb1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 5 May 2022 11:42:24 +0200 Subject: [PATCH] meson: move udev rules to rules.d/ --- TODO | 2 - {src/login => rules.d}/70-power-switch.rules | 0 {src/login => rules.d}/70-uaccess.rules.in | 0 {src/login => rules.d}/71-seat.rules.in | 0 {src/login => rules.d}/73-seat-late.rules.in | 0 rules.d/meson.build | 109 +++++++++++-------- src/login/meson.build | 35 +++--- 7 files changed, 78 insertions(+), 68 deletions(-) rename {src/login => rules.d}/70-power-switch.rules (100%) rename {src/login => rules.d}/70-uaccess.rules.in (100%) rename {src/login => rules.d}/71-seat.rules.in (100%) rename {src/login => rules.d}/73-seat-late.rules.in (100%) diff --git a/TODO b/TODO index 34d8c99edba..b64ed92dd15 100644 --- a/TODO +++ b/TODO @@ -1394,8 +1394,6 @@ Features: to query the list of boot entry titles that bootctl / sd-boot would show. Currently we only expose their identifiers. -* move logind udev rules to top-level rule.d/ directory - * move multiseat vid/pid matches from logind udev rule to hwdb * logind: rework pam_logind to also do a bus call in case of invocation from diff --git a/src/login/70-power-switch.rules b/rules.d/70-power-switch.rules similarity index 100% rename from src/login/70-power-switch.rules rename to rules.d/70-power-switch.rules diff --git a/src/login/70-uaccess.rules.in b/rules.d/70-uaccess.rules.in similarity index 100% rename from src/login/70-uaccess.rules.in rename to rules.d/70-uaccess.rules.in diff --git a/src/login/71-seat.rules.in b/rules.d/71-seat.rules.in similarity index 100% rename from src/login/71-seat.rules.in rename to rules.d/71-seat.rules.in diff --git a/src/login/73-seat-late.rules.in b/rules.d/73-seat-late.rules.in similarity index 100% rename from src/login/73-seat-late.rules.in rename to rules.d/73-seat-late.rules.in diff --git a/rules.d/meson.build b/rules.d/meson.build index f725e14d95d..a391390292c 100644 --- a/rules.d/meson.build +++ b/rules.d/meson.build @@ -4,54 +4,71 @@ install_data( 'README', install_dir : udevrulesdir) -rules = files( - '60-autosuspend.rules', - '60-block.rules', - '60-cdrom_id.rules', - '60-drm.rules', - '60-evdev.rules', - '60-fido-id.rules', - '60-input-id.rules', - '60-persistent-alsa.rules', - '60-persistent-input.rules', - '60-persistent-storage.rules', - '60-persistent-storage-tape.rules', - '60-persistent-v4l.rules', - '60-sensor.rules', - '60-serial.rules', - '70-camera.rules', - '70-joystick.rules', - '70-mouse.rules', - '70-touchpad.rules', - '75-net-description.rules', - '75-probe_mtd.rules', - '78-sound-card.rules', - '80-net-setup-link.rules', - '81-net-dhcp.rules') +rules = [ + [files('60-autosuspend.rules', + '60-block.rules', + '60-cdrom_id.rules', + '60-drm.rules', + '60-evdev.rules', + '60-fido-id.rules', + '60-input-id.rules', + '60-persistent-alsa.rules', + '60-persistent-input.rules', + '60-persistent-storage.rules', + '60-persistent-storage-tape.rules', + '60-persistent-v4l.rules', + '60-sensor.rules', + '60-serial.rules', + '70-camera.rules', + '70-joystick.rules', + '70-mouse.rules', + '70-touchpad.rules', + '75-net-description.rules', + '75-probe_mtd.rules', + '78-sound-card.rules', + '80-net-setup-link.rules', + '81-net-dhcp.rules', + )], -if conf.get('HAVE_KMOD') == 1 - rules += files('80-drivers.rules') -endif + [files('80-drivers.rules'), + conf.get('HAVE_KMOD') == 1], -if dmi_arches.contains(host_machine.cpu_family()) - rules += files('70-memory.rules') -endif + [files('70-memory.rules'), + dmi_arches.contains(host_machine.cpu_family())], +] -install_data(rules, - install_dir : udevrulesdir) +all_rules = [] -all_rules = rules - -rules_in = ['50-udev-default.rules', - '64-btrfs.rules', - '99-systemd.rules'] - -foreach file : rules_in - all_rules += custom_target( - file, - input : file + '.in', - output: file, - command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], - install : true, - install_dir : udevrulesdir) +foreach tuple : rules + if tuple.length() == 1 or tuple[1] + install_data(tuple[0], + install_dir : udevrulesdir) + all_rules += tuple[0] + endif +endforeach + +rules_in = [ + ['50-udev-default.rules'], + ['64-btrfs.rules'], + ['99-systemd.rules'], + + ['70-uaccess.rules', enable_logind and conf.get('HAVE_ACL') == 1], + ['71-seat.rules', enable_logind], + ['73-seat-late.rules', enable_logind], +] + +foreach tuple : rules_in + want = tuple.length() == 1 or tuple[1] + + rule = custom_target( + tuple[0], + input : tuple[0] + '.in', + output: tuple[0], + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], + install : want, + install_dir : udevrulesdir) + + if want + all_rules += rule + endif endforeach diff --git a/src/login/meson.build b/src/login/meson.build index bd350569d56..8be238254a9 100644 --- a/src/login/meson.build +++ b/src/login/meson.build @@ -65,25 +65,22 @@ pam_systemd_sym = 'src/login/pam_systemd.sym' pam_systemd_c = files('pam_systemd.c') enable_logind = conf.get('ENABLE_LOGIND') == 1 -in_files = [ - ['logind.conf', pkgsysconfdir, enable_logind and install_sysconfdir_samples], - ['70-uaccess.rules', udevrulesdir, enable_logind and conf.get('HAVE_ACL') == 1], - ['71-seat.rules', udevrulesdir, enable_logind], - ['73-seat-late.rules', udevrulesdir, enable_logind], - ['systemd-user', pamconfdir, enable_logind]] -foreach tuple : in_files - file = tuple[0] - dir = tuple[1] - install = (dir == pkgsysconfdir) ? install_sysconfdir_samples : (dir != 'no') - custom_target( - file, - input : file + '.in', - output: file, - command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], - install : tuple[2] and install, - install_dir : dir) -endforeach +custom_target( + 'logind.conf', + input : 'logind.conf.in', + output : 'logind.conf', + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], + install : enable_logind and install_sysconfdir_samples and pkgsysconfdir != 'no', + install_dir : pkgsysconfdir) + +custom_target( + 'systemd-user', + input : 'systemd-user.in', + output : 'systemd-user', + command : [jinja2_cmdline, '@INPUT@', '@OUTPUT@'], + install : enable_logind and pamconfdir != 'no', + install_dir : pamconfdir) if enable_logind install_data('org.freedesktop.login1.conf', @@ -92,8 +89,6 @@ if enable_logind install_dir : dbussystemservicedir) install_data('org.freedesktop.login1.policy', install_dir : polkitpolicydir) - install_data('70-power-switch.rules', - install_dir : udevrulesdir) endif ############################################################