X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/blobdiff_plain/e757fdc6a5b7e75117ead1a108fccaace1352bbb..HEAD:/tools/helpers/images.py?ds=sidebyside diff --git a/tools/helpers/images.py b/tools/helpers/images.py index 65a7ea5..8a88f29 100644 --- a/tools/helpers/images.py +++ b/tools/helpers/images.py @@ -81,6 +81,20 @@ def get(args): break remove_overlay(args) +def validate(args, channel, image_zip): + # Verify that the zip comes from the channel + cfg = tools.config.load(args) + channel_url = cfg["waydroid"][channel] + channel_request = helpers.http.retrieve(channel_url) + if channel_request[0] != 200: + return False + channel_responses = json.loads(channel_request[1].decode('utf8'))["response"] + for build in channel_responses: + if sha256sum(image_zip) == build['id']: + return True + logging.warning(f"Could not verify the image {image_zip} against {channel_url}") + return False + def replace(args, system_zip, system_time, vendor_zip, vendor_time): cfg = tools.config.load(args) args.images_path = cfg["waydroid"]["images_path"] @@ -122,10 +136,10 @@ def make_prop(args, cfg, full_props_path): add_prop("waydroid.host.uid", "user_id") add_prop("waydroid.host.gid", "group_id") add_prop("waydroid.host_data_path", "waydroid_data") - add_prop("waydroid.xdg_runtime_dir", "xdg_runtime_dir") - add_prop("waydroid.pulse_runtime_path", "pulse_runtime_path") - add_prop("waydroid.wayland_display", "wayland_display") add_prop("waydroid.background_start", "background_start") + props.append("waydroid.xdg_runtime_dir=" + tools.config.defaults["container_xdg_runtime_dir"]) + props.append("waydroid.pulse_runtime_path=" + tools.config.defaults["container_pulse_runtime_path"]) + props.append("waydroid.wayland_display=" + tools.config.defaults["container_wayland_display"]) if which("waydroid-sensord") is None: props.append("waydroid.stub_sensors_hal=1") dpi = cfg["lcd_density"] @@ -143,11 +157,17 @@ def mount_rootfs(args, images_dir, session): helpers.mount.mount(args, images_dir + "/system.img", tools.config.defaults["rootfs"], umount=True) if cfg["waydroid"]["mount_overlays"] == "True": - helpers.mount.mount_overlay(args, [tools.config.defaults["overlay"], - tools.config.defaults["rootfs"]], + try: + helpers.mount.mount_overlay(args, [tools.config.defaults["overlay"], + tools.config.defaults["rootfs"]], tools.config.defaults["rootfs"], upper_dir=tools.config.defaults["overlay_rw"] + "/system", work_dir=tools.config.defaults["overlay_work"] + "/system") + except RuntimeError: + cfg["waydroid"]["mount_overlays"] = "False" + tools.config.save(args, cfg) + logging.warning("Mounting overlays failed. The feature has been disabled.") + helpers.mount.mount(args, images_dir + "/vendor.img", tools.config.defaults["rootfs"] + "/vendor") if cfg["waydroid"]["mount_overlays"] == "True":