1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

meson: use jinja2 for src/login

{% raw %} is needed to avoid trouble with {%k, which jinja thinks
is trying to access variable 'k'.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-05-16 13:57:00 +02:00 committed by Yu Watanabe
parent d924a938fe
commit c900d89faa
6 changed files with 41 additions and 62 deletions

View File

@ -41,14 +41,14 @@ SUBSYSTEM=="firewire", TEST=="units", ENV{IEEE1394_UNIT_FUNCTION_VIDEO}=="1", TA
# DRI video devices
SUBSYSTEM=="drm", KERNEL=="card*", TAG+="uaccess"
m4_ifdef(`GROUP_RENDER_UACCESS',``
{% if GROUP_RENDER_UACCESS %}
# DRI render nodes
SUBSYSTEM=="drm", KERNEL=="renderD*", TAG+="uaccess"''
)m4_dnl
m4_ifdef(`DEV_KVM_UACCESS',``
SUBSYSTEM=="drm", KERNEL=="renderD*", TAG+="uaccess"
{% endif %}
{% if DEV_KVM_UACCESS %}
# KVM
SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="uaccess"''
)m4_dnl
SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="uaccess"
{% endif %}
# smart-card readers
ENV{ID_SMARTCARD_READER}=="?*", TAG+="uaccess"

View File

@ -59,9 +59,11 @@ SUBSYSTEM=="pci", ATTRS{vendor}=="0x1ab8", ATTRS{device}=="0x4005", TAG+="seat",
# the child if we notice that the parent wasn't recognized yet.
# Match parent
{% raw -%}
SUBSYSTEM=="usb", ATTR{idVendor}=="058f", ATTR{idProduct}=="6254", \
ATTR{%k.2/idVendor}=="17e9", ATTR{%k.2/idProduct}=="401a", ATTR{%k.2/product}=="mimo inc", \
ENV{ID_AUTOSEAT}="1", ENV{ID_AVOID_LOOP}="1"
{% endraw %}
# Match child, look for parent's ID_AVOID_LOOP
SUBSYSTEM=="usb", ATTR{idVendor}=="17e9", ATTR{idProduct}=="401a", ATTR{product}=="mimo inc", \
@ -72,11 +74,11 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="17e9", ATTR{idProduct}=="401a", ATTR{product}
SUBSYSTEM=="usb", ATTR{idVendor}=="17e9", ATTR{idProduct}=="401a", ATTR{product}=="mimo inc", \
ATTR{../idVendor}=="058f", ATTR{../idProduct}=="6254", \
ENV{ID_AVOID_LOOP}=="", \
RUN+="@rootbindir@/udevadm trigger --parent-match=%p/.."
RUN+="{{ROOTBINDIR}}/udevadm trigger --parent-match=%p/.."
TAG=="seat", ENV{ID_PATH}=="", IMPORT{builtin}="path_id"
TAG=="seat", ENV{ID_FOR_SEAT}=="", ENV{ID_PATH_TAG}!="", ENV{ID_FOR_SEAT}="$env{SUBSYSTEM}-$env{ID_PATH_TAG}"
SUBSYSTEM=="input", ATTR{name}=="Wiebetech LLC Wiebetech", RUN+="@rootbindir@/loginctl lock-sessions"
SUBSYSTEM=="input", ATTR{name}=="Wiebetech LLC Wiebetech", RUN+="{{ROOTBINDIR}}/loginctl lock-sessions"
LABEL="seat_end"

View File

@ -13,8 +13,8 @@ ENV{ID_SEAT}=="", ENV{ID_AUTOSEAT}=="1", ENV{ID_FOR_SEAT}!="", ENV{ID_SEAT}="sea
ENV{ID_SEAT}=="", IMPORT{parent}="ID_SEAT"
ENV{ID_SEAT}!="", TAG+="$env{ID_SEAT}"
m4_ifdef(`HAVE_ACL',``
TAG=="uaccess", ENV{MAJOR}!="", RUN{builtin}+="uaccess"''
)m4_dnl
{% if HAVE_ACL %}
TAG=="uaccess", ENV{MAJOR}!="", RUN{builtin}+="uaccess"
{% endif %}
LABEL="seat_late_end"

View File

@ -17,7 +17,7 @@
[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=@KILL_USER_PROCESSES@
#KillUserProcesses={{ "yes" if KILL_USER_PROCESSES else "no" }}
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5

View File

@ -65,58 +65,35 @@ user_runtime_dir_sources = files('''
pam_systemd_sym = 'src/login/pam_systemd.sym'
pam_systemd_c = files('pam_systemd.c')
if conf.get('ENABLE_LOGIND') == 1
logind_conf = configure_file(
input : 'logind.conf.in',
output : 'logind.conf',
configuration : substs)
if install_sysconfdir_samples
install_data(logind_conf,
install_dir : pkgsysconfdir)
endif
enable_logind = conf.get('ENABLE_LOGIND') == 1
in_files = [
['logind.conf', pkgsysconfdir, enable_logind],
['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 and pamconfdir != 'no']]
foreach tuple : in_files
file = tuple[0]
custom_target(
file,
input : file + '.in',
output: file,
command : [meson_render_jinja2, config_h, '@INPUT@'],
capture : true,
install : tuple[2],
install_dir : tuple[1])
endforeach
if enable_logind
install_data('org.freedesktop.login1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.login1.service',
install_dir : dbussystemservicedir)
install_data('org.freedesktop.login1.policy',
install_dir : polkitpolicydir)
install_data('70-power-switch.rules', install_dir : udevrulesdir)
seat_rules = configure_file(
input : '71-seat.rules.in',
output : '71-seat.rules',
configuration : substs)
install_data(seat_rules,
install_data('70-power-switch.rules',
install_dir : udevrulesdir)
custom_target(
'70-uaccess.rules',
input : '70-uaccess.rules.m4',
output: '70-uaccess.rules',
command : [meson_apply_m4, config_h, '@INPUT@'],
capture : true,
install : conf.get('HAVE_ACL') == 1,
install_dir : udevrulesdir)
custom_target(
'73-seat-late.rules',
input : '73-seat-late.rules.m4',
output: '73-seat-late.rules',
command : [meson_apply_m4, config_h, '@INPUT@'],
capture : true,
install : true,
install_dir : udevrulesdir)
custom_target(
'systemd-user',
input : 'systemd-user.m4',
output: 'systemd-user',
command : [meson_apply_m4, config_h, '@INPUT@'],
capture : true,
install : pamconfdir != 'no',
install_dir : pamconfdir)
endif
############################################################

View File

@ -2,19 +2,19 @@
#
# Used by systemd --user instances.
m4_ifdef(`ENABLE_HOMED',
{% if ENABLE_HOMED %}
-account sufficient pam_systemd_home.so
)m4_dnl
{% endif %}
account sufficient pam_unix.so
account required pam_permit.so
m4_ifdef(`HAVE_SELINUX',
{% if HAVE_SELINUX %}
session required pam_selinux.so close
session required pam_selinux.so nottys open
)m4_dnl
{% endif %}
session required pam_loginuid.so
session optional pam_keyinit.so force revoke
m4_ifdef(`ENABLE_HOMED',
{% if ENABLE_HOMED %}
-session optional pam_systemd_home.so
)m4_dnl
{% endif %}
session optional pam_systemd.so