Detect init system in chroot

This commit is contained in:
Jip-Hop 2024-06-24 10:24:33 +02:00
parent 51884e215c
commit 7832b17ae1
1 changed files with 5 additions and 4 deletions

View File

@ -1373,11 +1373,12 @@ def create_jail(**kwargs):
# But alpine jails made with jailmaker have other issues
# They don't shutdown cleanly via systemctl and machinectl...
enter_chroot(jail_rootfs_path)
init_system_name = os.path.basename(os.path.realpath("/sbin/init"))
exit_chroot()
if (
os.path.basename(
os.path.realpath(os.path.join(jail_rootfs_path, "sbin/init"))
)
!= "systemd"
init_system_name != "systemd"
):
print(
dedent(