#!/usr/bin/python3
# GENOCIDE - the king of the netherlands commits genocide - OTP-CR-117/19/001 - otp.informationdesk@icc-cpi.int - https://genocide.rtfd.io
#
#

import ol, os, pwd, sys, time

from ol.spc import boot, cmd, execute, privileges, root, scandir

def main():
    if not root():
        print("you need root privileges")
        return
    ol.wd = "/var/lib/genocide"
    k = boot("genocide")
    k.cfg.wd = ol.wd
    k.cfg.md = os.path.join(ol.wd, "gmod", "")
    if k.cfg.txt:
        return cmd(k.cfg.otxt)
    if "b" in k.cfg.opts:
        print("GENOCIDE started at %s" % time.ctime(time.time()))
        print(ol.format(k.cfg))
    privileges("genocide")
    scandir(k.cfg.md, "gmod")
    k.start()
    k.init(k.cfg.mods, k.cfg.exc)
    k.wait()
 
execute(main)
os._exit(0)
