attempt to add systemd-support for gentoo

This commit is contained in:
2024-06-16 13:45:51 +02:00
parent cd33f98b8b
commit 5e5b77ed5e
2 changed files with 17 additions and 2 deletions

View File

@ -46,6 +46,12 @@ def init():
def fork_and_reboot():
log = logging.getLogger(sau.LOGNAME)
if os.path.exist('/proc/1/comm'):
with open('/proc/1/comm', 'r') as f:
if f.readline() == 'systemd':
os.execl('/usr/bin/systemctl', 'reboot')
log.error("Failed to execl?")
sys.exit(1)
try:
pid = os.fork()
if pid != 0: