From 0062322638aa36df8190326a6afd38780fb7a271 Mon Sep 17 00:00:00 2001
From: Kai Wohlfahrt <kai.wohlfahrt@gmail.com>
Date: Tue, 14 Sep 2021 00:32:52 +0100
Subject: [PATCH] Respect install_sysconfdir

This was lost e11a25cadbe and c900d89faa0 while adding jinja2
templating. Breaks builds on NixOS.

(cherry picked from commit 679de141122ca30388bba6d132f8c0dddcdddd15)

Conflict:NA
Reference:https://github.com/systemd/systemd/commit/0062322638aa36df8190326a6afd38780fb7a271
---
 src/core/meson.build  | 2 +-
 src/login/meson.build | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/core/meson.build b/src/core/meson.build
index c66538eab1..367c085027 100644
--- a/src/core/meson.build
+++ b/src/core/meson.build
@@ -193,7 +193,7 @@ foreach item : in_files
                 output: file,
                 command : [meson_render_jinja2, config_h, '@INPUT@'],
                 capture : true,
-                install : (dir == pkgsysconfdir and install_sysconfdir_samples) or (dir != pkgsysconfdir and dir != 'no'),
+                install : (dir == pkgsysconfdir) ? install_sysconfdir_samples : (dir != 'no'),
                 install_dir : dir)
 endforeach
 
diff --git a/src/login/meson.build b/src/login/meson.build
index b637adc9a2..da704d238f 100644
--- a/src/login/meson.build
+++ b/src/login/meson.build
@@ -71,18 +71,20 @@ in_files = [
         ['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']]
+        ['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 : [meson_render_jinja2, config_h, '@INPUT@'],
                 capture : true,
-                install : tuple[2],
-                install_dir : tuple[1])
+                install : tuple[2] and install,
+                install_dir : dir)
 endforeach
 
 if enable_logind
-- 
2.33.0

