Esempio n. 1
0
def initialise():
    credentials.save_credentials()
    update_config_files()
    if sys.platform == "linux":
        if subprocess.check_output(["/bin/uname", "-o"]).decode(
                sys.stdout.encoding).strip() == "ASUSWRT-Merlin":
            initd.install_service()
        else:
            systemd.install_service()
    return
Esempio n. 2
0
def initialise(log_folder: str) -> bool:
    credentials.save_credentials()
    update_config_files()
    if not os.path.exists(log_folder):
        os.mkdir(log_folder)
        os.chmod(log_folder, mode=0o777)
        open(log_folder + "/openpyn.log", "a").close()      # touch the log file
        os.chmod(log_folder + "/openpyn.log", mode=0o777)
    if sys.platform == "linux":
        if subprocess.check_output(["/bin/uname", "-o"]).decode(sys.stdout.encoding).strip() == "ASUSWRT-Merlin":
            return initd.install_service()
        elif os.path.exists("/etc/openwrt_release"):
            return initd.install_service()
        elif subprocess.check_output(["cat", "/proc/1/comm"]).decode(sys.stdout.encoding).strip() == "systemd":
            return systemd.install_service()
        logger.warning("systemd not found, skipping systemd integration")
        return 1