X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/blobdiff_plain/f9de8c4283ffa11c0382eff5952422f0bb64159a..8a9fdcac1ccddf56147f9cc34f42514b2384a5bd:/tools/actions/initializer.py diff --git a/tools/actions/initializer.py b/tools/actions/initializer.py index f527ec8..b7124d4 100644 --- a/tools/actions/initializer.py +++ b/tools/actions/initializer.py @@ -2,10 +2,11 @@ # SPDX-License-Identifier: GPL-3.0-or-later import logging import os -import requests from tools import helpers import tools.config +def is_initialized(args): + return os.path.isfile(args.config) and os.path.isdir(tools.config.defaults["rootfs"]) def get_vendor_type(args): vndk_str = helpers.props.host_get(args, "ro.vndk.version") @@ -57,7 +58,7 @@ def setup_config(args): args.vendor_type = None for vendor in [device_codename, get_vendor_type(args)]: vendor_ota = args.vendor_channel + "/waydroid_" + \ - args.arch + "/" + vendor + ".json" + args.arch + "/" + vendor.replace(" ", "_") + ".json" vendor_request = helpers.http.retrieve(vendor_ota) if vendor_request[0] == 200: args.vendor_type = vendor @@ -82,7 +83,7 @@ def setup_config(args): tools.config.save(args, cfg) def init(args): - if not os.path.isfile(args.config) or args.force: + if not is_initialized(args) or args.force: setup_config(args) status = "STOPPED" if os.path.exists(tools.config.defaults["lxc"] + "/waydroid"): @@ -102,5 +103,7 @@ def init(args): logging.info("Starting container") helpers.images.mount_rootfs(args, args.images_path) helpers.lxc.start(args) + + helpers.ipc.notify(channel="init", msg="done") else: logging.info("Already initialized")