From dd16034e3cdfff755f1b3b4194f94005caae133c Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 1 Oct 2024 18:41:31 -0700 Subject: [PATCH] names: Introduce method to check if resolved is installed Signed-off-by: Sunil Mohan Adapa Reviewed-by: Veiko Aasa --- plinth/modules/names/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plinth/modules/names/__init__.py b/plinth/modules/names/__init__.py index adb63c6f6..de48e4633 100644 --- a/plinth/modules/names/__init__.py +++ b/plinth/modules/names/__init__.py @@ -4,6 +4,7 @@ FreedomBox app to configure name services. """ import logging +import pathlib import socket import subprocess @@ -209,3 +210,8 @@ def get_available_tls_domains(): """Return an iterator with all domains able to have a certificate.""" return (domain.name for domain in components.DomainName.list() if domain.domain_type.can_have_certificate) + + +def is_resolved_installed(): + """Return whether systemd-resolved is installed.""" + return pathlib.Path('/usr/bin/resolvectl').exists()