From beb9b218f94872e70d02578d4ff016e08abc4717 Mon Sep 17 00:00:00 2001
From: Ming Liu <liu.ming50@gmail.com>
Date: Wed, 14 Feb 2024 12:03:26 +0100
Subject: [PATCH] Make full path to systemd-tty-ask-password-agent configurable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Upstream-Status: Inappropriate [embedded specific]

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
---
 meson.build               | 2 +-
 meson_options.txt         | 5 +++++
 systemd-units/meson.build | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 26789060..c6996aed 100644
--- a/meson.build
+++ b/meson.build
@@ -44,7 +44,7 @@ if get_option('systemd-integration')
   systemd_unit_dir = systemd_dep.get_variable('systemdsystemunitdir',
     pkgconfig_define: [ 'rootprefix', get_option('prefix') ],
   )
-  systemd_ask_password_agent = find_program('systemd-tty-ask-password-agent')
+  systemd_ask_password_agent = get_option('systemd-tty-ask-password-agent')
 endif
 
 if get_option('upstart-monitoring')
diff --git a/meson_options.txt b/meson_options.txt
index 4f601bb0..aac661fc 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -53,6 +53,11 @@ option('systemd-integration',
   value: true,
   description: 'Coordinate boot up with systemd',
 )
+option('systemd-tty-ask-password-agent',
+  type: 'string',
+  value: '/bin/systemd-tty-ask-password-agent',
+  description: 'Path of systemd-tty-ask-password-agent',
+)
 option('udev',
   type: 'feature',
   value: 'auto',
diff --git a/systemd-units/meson.build b/systemd-units/meson.build
index 06379312..7adc86ae 100644
--- a/systemd-units/meson.build
+++ b/systemd-units/meson.build
@@ -21,7 +21,7 @@ foreach unit_templ : systemd_unit_templates
       'PLYMOUTH_CLIENT_DIR': get_option('prefix') / get_option('bindir'),
       'PLYMOUTH_DAEMON_DIR': get_option('prefix') / get_option('sbindir'),
       'plymouthruntimedir': plymouth_runtime_dir,
-      'SYSTEMD_ASK_PASSWORD_AGENT': systemd_ask_password_agent.full_path(),
+      'SYSTEMD_ASK_PASSWORD_AGENT': systemd_ask_password_agent,
     },
     install: true,
     install_dir: systemd_unit_dir,
-- 
2.34.1

