update_manager: workaround zipfile permission issues

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2024-01-16 12:35:38 -05:00
parent 15fed2e819
commit c196f7548c
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
2 changed files with 7 additions and 3 deletions

View File

@ -371,9 +371,11 @@ class WebClientDeploy(BaseDeploy):
os.makedirs(dest_dir, exist_ok=True) os.makedirs(dest_dir, exist_ok=True)
shutil.move(str(src_path), str(dest_path)) shutil.move(str(src_path), str(dest_path))
shutil.rmtree(self.path) shutil.rmtree(self.path)
os.mkdir(self.path) self.path.mkdir()
with zipfile.ZipFile(release_file) as zf: with zipfile.ZipFile(release_file) as zf:
zf.extractall(self.path) for zip_entry in zf.filelist:
dest = pathlib.Path(zf.extract(zip_entry, str(self.path)))
dest.chmod((zip_entry.external_attr >> 16) & 0o777)
# Move temporary files back into # Move temporary files back into
for src_path in persist_dir.iterdir(): for src_path in persist_dir.iterdir():
dest_path = self.path.joinpath(src_path.name) dest_path = self.path.joinpath(src_path.name)

View File

@ -347,7 +347,9 @@ class ZipDeploy(AppDeploy):
shutil.rmtree(self.path) shutil.rmtree(self.path)
os.mkdir(self.path) os.mkdir(self.path)
with zipfile.ZipFile(release_zip) as zf: with zipfile.ZipFile(release_zip) as zf:
zf.extractall(self.path) for zip_entry in zf.filelist:
dest = pathlib.Path(zf.extract(zip_entry, str(self.path)))
dest.chmod((zip_entry.external_attr >> 16) & 0o777)
async def update(self, force_dep_update: bool = False) -> bool: async def update(self, force_dep_update: bool = False) -> bool:
if not self._is_valid: if not self._is_valid: