]> glassweightruler.freedombox.rocks Git - waydroid.git/commitdiff
Remove RW image overlay when upgrading images
authorSebastian Krzyszkowiak <dos@dosowisko.net>
Thu, 10 Nov 2022 21:15:27 +0000 (22:15 +0100)
committerAlessandro Astone <ales.astone@gmail.com>
Thu, 12 Jan 2023 20:31:19 +0000 (21:31 +0100)
tools/actions/initializer.py
tools/helpers/images.py

index 31b4fc90253ca720b6a0440b3e1b426540e049a0..fdc4a40a3c6a3a6d58f654114158722e3a6086fb 100644 (file)
@@ -117,6 +117,8 @@ def init(args):
         helpers.images.umount_rootfs(args)
         if args.images_path not in tools.config.defaults["preinstalled_images_paths"]:
             helpers.images.get(args)
         helpers.images.umount_rootfs(args)
         if args.images_path not in tools.config.defaults["preinstalled_images_paths"]:
             helpers.images.get(args)
+        else:
+            helpers.images.remove_overlay(args)
         if not os.path.isdir(tools.config.defaults["rootfs"]):
             os.mkdir(tools.config.defaults["rootfs"])
         if not os.path.isdir(tools.config.defaults["overlay"]):
         if not os.path.isdir(tools.config.defaults["rootfs"]):
             os.mkdir(tools.config.defaults["rootfs"])
         if not os.path.isdir(tools.config.defaults["overlay"]):
index e00e9b1f43359f955d5cabae0184a064c3de964e..c5d5fad70d907521bcf17eed7d898b7888e11782 100644 (file)
@@ -4,6 +4,7 @@ import logging
 import zipfile
 import json
 import hashlib
 import zipfile
 import json
 import hashlib
+import shutil
 import os
 import tools.config
 from tools import helpers
 import os
 import tools.config
 from tools import helpers
@@ -78,6 +79,7 @@ def get(args):
             tools.config.save(args, cfg)
             os.remove(images_zip)
             break
             tools.config.save(args, cfg)
             os.remove(images_zip)
             break
+    remove_overlay(args)
 
 def replace(args, system_zip, system_time, vendor_zip, vendor_time):
     cfg = tools.config.load(args)
 
 def replace(args, system_zip, system_time, vendor_zip, vendor_time):
     cfg = tools.config.load(args)
@@ -92,6 +94,13 @@ def replace(args, system_zip, system_time, vendor_zip, vendor_time):
             zip_ref.extractall(args.images_path)
         cfg["waydroid"]["vendor_datetime"] = str(vendor_time)
         tools.config.save(args, cfg)
             zip_ref.extractall(args.images_path)
         cfg["waydroid"]["vendor_datetime"] = str(vendor_time)
         tools.config.save(args, cfg)
+    remove_overlay(args)
+
+def remove_overlay(args):
+    if os.path.isdir(tools.config.defaults["overlay_rw"]):
+        shutil.rmtree(tools.config.defaults["overlay_rw"])
+    if os.path.isdir(tools.config.defaults["overlay_work"]):
+        shutil.rmtree(tools.config.defaults["overlay_work"])
 
 def make_prop(args, cfg, full_props_path):
     if not os.path.isfile(args.work + "/waydroid_base.prop"):
 
 def make_prop(args, cfg, full_props_path):
     if not os.path.isfile(args.work + "/waydroid_base.prop"):