X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/blobdiff_plain/d9a7823c54a36d7bec61dc5ed2921789da371fcf..5dbaef56a19ed1bfcd78e21d75443eadefe67f00:/tools/actions/upgrader.py diff --git a/tools/actions/upgrader.py b/tools/actions/upgrader.py index dcd033d..9c5d04a 100644 --- a/tools/actions/upgrader.py +++ b/tools/actions/upgrader.py @@ -20,7 +20,7 @@ def migration(args): try: old_ver = tools.helpers.props.file_get(args, args.work + "/waydroid_base.prop", "waydroid.tools_version") if versiontuple(old_ver) <= versiontuple("1.3.4"): - chmod_paths = ["cache_http", "host-permissions", "lxc", "images", "waydroid_base.prop", "waydroid.prop", "waydroid.cfg"] + chmod_paths = ["cache_http", "host-permissions", "lxc", "images", "rootfs", "data", "waydroid_base.prop", "waydroid.prop", "waydroid.cfg"] tools.helpers.run.user(args, ["chmod", "-R", "g-w,o-w"] + [os.path.join(args.work, f) for f in chmod_paths], check=False) tools.helpers.run.user(args, ["chmod", "g-w,o-w", args.work], check=False) except: @@ -28,18 +28,19 @@ def migration(args): def upgrade(args): get_config(args) - migration(args) status = "STOPPED" if os.path.exists(tools.config.defaults["lxc"] + "/waydroid"): status = helpers.lxc.status(args) if status != "STOPPED": logging.info("Stopping container") - helpers.lxc.stop(args) try: - args.session = tools.helpers.ipc.DBusContainerService().GetSession() - except dbus.DBusException: - pass - helpers.images.umount_rootfs(args) + container = tools.helpers.ipc.DBusContainerService() + args.session = container.GetSession() + container.Stop(False) + except Exception as e: + logging.debug(e) + tools.actions.container_manager.stop(args) + migration(args) helpers.drivers.loadBinderNodes(args) if not args.offline: if args.images_path not in tools.config.defaults["preinstalled_images_paths"]: @@ -50,8 +51,10 @@ def upgrade(args): helpers.lxc.setup_host_perms(args) helpers.lxc.set_lxc_config(args) helpers.lxc.make_base_props(args) - if status != "STOPPED" and args.session: + if status != "STOPPED": logging.info("Starting container") - helpers.images.mount_rootfs(args, args.images_path, args.session) - helpers.protocol.set_aidl_version(args) - helpers.lxc.start(args) + try: + container.Start(args.session) + except Exception as e: + logging.debug(e) + logging.error("Failed to restart container. Please do so manually.")