container: Work in the absence of systemd in PATH, for eg. in Arch

Closes: #2072
This commit is contained in:
Aditya Pratap Singh authored and Sunil Mohan Adapa committed 2021-03-27 09:34:22 -07:00
1 parent 95236bcb78
commit c1f2b32b94
1 file changed
+6 -2
+6 -2
View File
@@ -382,8 +382,12 @@ def _verify_dependencies():
def _get_systemd_nspawn_version():
"""Retrieve and store systemd-nspawn version (same as systemd)."""
process = subprocess.run(['systemd', '--version'], stdout=subprocess.PIPE,
check=True)
try:
process = subprocess.run(['systemd', '--version'], stdout=subprocess.PIPE,
check=True)
except FileNotFoundError:
process = subprocess.run(['/usr/lib/systemd/systemd', '--version'], stdout=subprocess.PIPE,
check=True)
global systemd_version
systemd_version = float(process.stdout.decode().split()[1])