mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 21:06:09 +00:00
Windows components: install from a recording of the installer's result (#495)
* Windows components: install from a recording of the installer's result A catalog entry may name a 'snapshot': what its own setup program leaves in a prefix, recorded once in Wine by winlator-contents' tools/snapshot/record.py (the files it places and the registry values it writes, the self-registering DLLs' CLSID entries included). With one, the setup program never runs here: the files come from the archive beside the recording, or out of the vendor's installer by the paths the recording maps (small generated ones inline), and the registry values go to registry.json for droiddeck-wincomponents to write at launch. The steps a recording makes redundant are skipped; DLL overrides still apply. A component with a recording counts as installable; its prerequisites must still be. * droiddeck-msi-install --unpack: open archives nested inside an installer QuickTime's cabinets and an NSIS pack's payloads sit inside the unpacked installer; they are opened in place into '<name>.nested' folders, two levels deep, the same layout the component recordings map their file sources to, so a recording's paths resolve on the device (QuickTime: 593 of 593).
This commit is contained in:
1 parent
0da45e53cb
commit
d15ffa3df2
3 files changed
+162
-3
No files matched your search
@@ -992,11 +992,39 @@ def install_wrapper(path, out):
|
||||
return total
|
||||
|
||||
|
||||
NESTED_SUFFIXES = (".7z", ".zip", ".cab", ".exe", ".msi", ".rar", ".xz", ".gz", ".tar")
|
||||
|
||||
|
||||
def open_nested(dest, depth=0):
|
||||
"""Archives inside an unpacked installer (QuickTime's cabinets, an NSIS pack's payloads) are
|
||||
opened in place, one "<name>.nested" folder per archive, two levels deep: the same layout the
|
||||
component recordings (winlator-contents tools/snapshot/record.py) map their file sources to."""
|
||||
if depth > 1:
|
||||
return 0
|
||||
opened = 0
|
||||
for path in sorted(p for p in dest.rglob("*") if p.is_file() and p.suffix.lower() in NESTED_SUFFIXES):
|
||||
if path.name.endswith(".nested") or path.stat().st_size < 1024 or ".nested/" in path.relative_to(dest).as_posix() and depth == 0 and False:
|
||||
continue
|
||||
probe = run_tool([SEVENZIP, "l", "-ba", str(path)], timeout=300)
|
||||
if probe.returncode != 0 or not probe.stdout.strip():
|
||||
continue
|
||||
folder = path.with_name(path.name + ".nested")
|
||||
folder.mkdir(exist_ok=True)
|
||||
run_tool([SEVENZIP, "x", "-y", "-bd", "-bso0", "-bsp0", "-o" + str(folder), str(path)])
|
||||
if any(folder.rglob("*")):
|
||||
opened += 1 + open_nested(folder, depth + 1)
|
||||
else:
|
||||
shutil.rmtree(folder, ignore_errors=True)
|
||||
return opened
|
||||
|
||||
|
||||
def unpack_only(path, dest):
|
||||
dest.mkdir(parents=True, exist_ok=True)
|
||||
how = unpack_installer(path, dest)
|
||||
progress("opening archives inside %s" % path.name)
|
||||
nested = open_nested(dest)
|
||||
files = sorted(str(entry.relative_to(dest)) for entry in dest.rglob("*") if entry.is_file())
|
||||
return {"how": how, "files": len(files), "names": files[:2000]}
|
||||
return {"how": how, "files": len(files), "nested": nested, "names": files[:2000]}
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in new issue
Block a user