fix selinux policy for reboots

This commit is contained in:
2026-11-21 09:48:46 +01:00
parent f6e76f8635
commit ca92d3f564
2 changed files with 9 additions and 8 deletions
+7 -7
View File
@@ -52,6 +52,13 @@ def fork_and_reboot(report_success=True):
else:
exit_code=1
# reboot the systemd way on supported platforms
if os.path.exists('/proc/1/comm'):
with open('/proc/1/comm', 'r') as f:
if f.readline().strip() == 'systemd':
os.execl('/usr/bin/systemctl', 'systemctl', 'reboot', '--no-block', '--when=+1m')
log.error("Failed to execl?")
sys.exit(1)
try:
pid = os.fork()
if pid != 0:
@@ -72,13 +79,6 @@ def fork_and_reboot(report_success=True):
log.error("Fork #2 failed when going for reboot: {}".format(err))
sys.exit(1)
# reboot the systemd way on supported platforms
if os.path.exists('/proc/1/comm'):
with open('/proc/1/comm', 'r') as f:
if f.readline().strip() == 'systemd':
os.execl('/usr/bin/systemctl', 'systemctl', 'reboot', '--no-block', '--when=+1m')
log.error("Failed to execl?")
sys.exit(1)
sys.stdout.flush()