mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 14:26:00 +00:00
fix(epic): install the Epic Games Launcher from its Linux .deb
Epic no longer serves the Linux AppImage: the installer URL answers 404 errors.com.epicgames.launcher.app_direct_url_not_found (30003), so Install failed for everyone. Epic now ships EpicGamesLauncher-x86_64.deb (0.113.0+g2164614). - The installer downloads the .deb, checks its ar magic and the CDN ETag, and droiddeck-epic unpacks its data.tar.* member straight from the archive. - The .deb links WebKitGTK 4.1, JavaScriptCoreGTK 4.1 and GTK 3, which the Steam Runtime 4 image does not ship. 32 Debian 13 amd64 packages, pinned by SHA-256 and size (60.2 MB download, 201 MB unpacked), are unpacked into the launcher's desktop/ folder (shared libraries only) and put on its LD_LIBRARY_PATH. Debian 13 matches the runtime's own base, so only sonames the runtime lacks are added. Each package falls back to snapshot.debian.org when the deb.debian.org pool has moved on. - WebKit starts its helper processes from its built-in /usr/lib/x86_64-linux-gnu/webkit2gtk-4.1 path, so each launch links that folder in the runtime to the layer's copy. - An installed AppImage launcher keeps starting through its AppRun; the next update check moves it to the .deb. Closure checked offline: every ELF in the .deb and the layer resolves with the runtime's own ld-linux-x86-64.so.2 inside a sandbox holding only the runtime, the layer and libGLESv2 (0 missing, 0 version or undefined symbol errors with LD_BIND_NOW). Based on zooluis's research in #2268. Co-authored-by: zooluis <150430329+zooluis@users.noreply.github.com>
This commit is contained in:
1 parent
2bd7df5e1a
commit
7309e2f63d
5 files changed
+386
-101
No files matched your search
@@ -4,7 +4,6 @@ import collections
|
||||
import fcntl
|
||||
import filecmp
|
||||
import http.client
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
@@ -72,6 +71,14 @@ APP_ID = "com.epicgames.eglv2"
|
||||
DBUS_NAME = APP_ID + ".SingleInstance"
|
||||
DBUS_PATH = "/" + APP_ID.replace(".", "/") + "/SingleInstance"
|
||||
DBUS_METHOD = "org.SingleInstance.DBus.ExecuteCallback"
|
||||
APP_BIN = "usr/bin/EpicGamesLauncher"
|
||||
DEB_ICON = "usr/share/icons/hicolor/256x256@2/apps/EpicGamesLauncher.png"
|
||||
ICON = "epic-games-launcher.png"
|
||||
DESKTOP = "desktop"
|
||||
DESKTOP_KEEP = "usr/lib/x86_64-linux-gnu/"
|
||||
DESKTOP_LIB = DESKTOP + "/" + DESKTOP_KEEP.rstrip("/")
|
||||
WEBKIT_DIR = "webkit2gtk-4.1"
|
||||
WEBKIT_LIB = "libwebkit2gtk-4.1.so.0"
|
||||
SKIPPED = ("lib/i386-linux-gnu", "lib32", "libx32", "i686-pc-linux-gnu", "share/doc", "include")
|
||||
SETTINGS_SEED = {
|
||||
"minimizeToTray": False,
|
||||
@@ -254,6 +261,35 @@ def inside(root, path):
|
||||
return real == root or real.startswith(root + os.sep)
|
||||
|
||||
|
||||
def unpack_member(archive, member, staging, root, name, link):
|
||||
target = os.path.join(staging, name)
|
||||
if not inside(root, os.path.dirname(target)):
|
||||
return False
|
||||
if member.isdir():
|
||||
os.makedirs(target, exist_ok=True)
|
||||
return False
|
||||
os.makedirs(os.path.dirname(target), exist_ok=True)
|
||||
if not inside(root, os.path.dirname(target)):
|
||||
return False
|
||||
if member.issym():
|
||||
remove(target)
|
||||
os.symlink(link(target, member.linkname), target)
|
||||
elif member.islnk():
|
||||
source = safe_name(member.linkname)
|
||||
source = os.path.join(staging, source) if source else None
|
||||
if source and os.path.isfile(source) and inside(root, source):
|
||||
remove(target)
|
||||
shutil.copy2(source, target)
|
||||
elif member.isfile():
|
||||
remove(target)
|
||||
with archive.extractfile(member) as src, open(target, "wb") as out:
|
||||
shutil.copyfileobj(src, out, 1 << 20)
|
||||
os.chmod(target, (member.mode & 0o777) | 0o600)
|
||||
else:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def extract_runtime(tarball, dest):
|
||||
staging = dest + ".staging"
|
||||
remove(staging)
|
||||
@@ -271,32 +307,12 @@ def extract_runtime(tarball, dest):
|
||||
continue
|
||||
if top == "files" and rest and skipped(rest):
|
||||
continue
|
||||
target = os.path.join(staging, name)
|
||||
if not inside(root, os.path.dirname(target)):
|
||||
continue
|
||||
if member.isdir():
|
||||
os.makedirs(target, exist_ok=True)
|
||||
continue
|
||||
os.makedirs(os.path.dirname(target), exist_ok=True)
|
||||
if not inside(root, os.path.dirname(target)):
|
||||
continue
|
||||
if member.issym():
|
||||
remove(target)
|
||||
os.symlink(rooted_link(files_root, target, member.linkname) if top == "files" else member.linkname, target)
|
||||
elif member.islnk():
|
||||
source = safe_name(member.linkname)
|
||||
source = os.path.join(staging, source) if source else None
|
||||
if source and os.path.isfile(source) and inside(root, source):
|
||||
remove(target)
|
||||
shutil.copy2(source, target)
|
||||
elif member.isfile():
|
||||
remove(target)
|
||||
with archive.extractfile(member) as src, open(target, "wb") as out:
|
||||
shutil.copyfileobj(src, out, 1 << 20)
|
||||
os.chmod(target, (member.mode & 0o777) | 0o600)
|
||||
if top == "files":
|
||||
link = lambda target, linkname: rooted_link(files_root, target, linkname)
|
||||
else:
|
||||
continue
|
||||
count += 1
|
||||
link = lambda target, linkname: linkname
|
||||
if unpack_member(archive, member, staging, root, name, link):
|
||||
count += 1
|
||||
if not os.path.isfile(os.path.join(files_root, "lib", "x86_64-linux-gnu", "libc.so.6")) and \
|
||||
not os.path.islink(os.path.join(files_root, "lib", "x86_64-linux-gnu", "libc.so.6")):
|
||||
remove(staging)
|
||||
@@ -306,63 +322,126 @@ def extract_runtime(tarball, dest):
|
||||
return staging, count
|
||||
|
||||
|
||||
def ar_members(path):
|
||||
@contextlib.contextmanager
|
||||
def deb_data(path, reason):
|
||||
with open(path, "rb") as f:
|
||||
if f.read(8) != b"!<arch>\n":
|
||||
raise Failure("gles-format")
|
||||
raise Failure(reason)
|
||||
while True:
|
||||
header = f.read(60)
|
||||
if len(header) < 60:
|
||||
return
|
||||
raise Failure(reason)
|
||||
name = header[:16].decode("ascii", "replace").strip().rstrip("/")
|
||||
size = int(header[48:58].decode("ascii").strip())
|
||||
data = f.read(size)
|
||||
if size % 2:
|
||||
f.read(1)
|
||||
yield name, data
|
||||
if name.startswith("data.tar"):
|
||||
with tarfile.open(fileobj=f, mode="r|*") as archive:
|
||||
yield archive
|
||||
return
|
||||
f.seek(size + size % 2, os.SEEK_CUR)
|
||||
|
||||
|
||||
def is_deb(path):
|
||||
try:
|
||||
with open(path, "rb") as f:
|
||||
return f.read(21) == b"!<arch>\ndebian-binary"
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def install_gles(deb, files_root):
|
||||
libdir = os.path.join(files_root, "lib", "x86_64-linux-gnu")
|
||||
os.makedirs(libdir, exist_ok=True)
|
||||
for name, data in ar_members(deb):
|
||||
if not name.startswith("data.tar"):
|
||||
continue
|
||||
with tarfile.open(fileobj=io.BytesIO(data), mode="r:*") as archive:
|
||||
for member in archive:
|
||||
base = os.path.basename(member.name)
|
||||
if not base.startswith("libGLESv2.so"):
|
||||
continue
|
||||
target = os.path.join(libdir, base)
|
||||
remove(target)
|
||||
if member.issym():
|
||||
os.symlink(os.path.basename(member.linkname), target)
|
||||
elif member.isfile():
|
||||
with archive.extractfile(member) as src, open(target, "wb") as out:
|
||||
shutil.copyfileobj(src, out)
|
||||
os.chmod(target, 0o644)
|
||||
if os.path.exists(os.path.join(libdir, "libGLESv2.so.2")):
|
||||
return
|
||||
raise Failure("gles-missing")
|
||||
with deb_data(deb, "gles-format") as archive:
|
||||
for member in archive:
|
||||
base = os.path.basename(member.name)
|
||||
if not base.startswith("libGLESv2.so"):
|
||||
continue
|
||||
target = os.path.join(libdir, base)
|
||||
remove(target)
|
||||
if member.issym():
|
||||
os.symlink(os.path.basename(member.linkname), target)
|
||||
elif member.isfile():
|
||||
with archive.extractfile(member) as src, open(target, "wb") as out:
|
||||
shutil.copyfileobj(src, out)
|
||||
os.chmod(target, 0o644)
|
||||
if not os.path.exists(os.path.join(libdir, "libGLESv2.so.2")):
|
||||
raise Failure("gles-missing")
|
||||
|
||||
|
||||
def extract_app(image, dest):
|
||||
def extract_deb(deb, dest, wanted=None):
|
||||
root = os.path.realpath(dest)
|
||||
|
||||
def link(target, linkname):
|
||||
if not linkname.startswith("/"):
|
||||
return linkname
|
||||
return os.path.relpath(os.path.join(dest, linkname.lstrip("/")), os.path.dirname(target))
|
||||
|
||||
count = 0
|
||||
with deb_data(deb, "app-format") as archive:
|
||||
for member in archive:
|
||||
name = safe_name(member.name)
|
||||
if name is None or (wanted is not None and not wanted(name)):
|
||||
continue
|
||||
if unpack_member(archive, member, dest, root, name, link):
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
def extract_app(image, dest, desktop=()):
|
||||
staging = dest + ".staging"
|
||||
remove(staging)
|
||||
os.makedirs(staging)
|
||||
status = subprocess.call([os.path.join(BIN_DIR, "droiddeck-fex"), "extract", os.path.abspath(image)],
|
||||
cwd=staging, stdout=subprocess.DEVNULL)
|
||||
root = os.path.realpath(os.path.join(staging, "squashfs-root"))
|
||||
if status != 0 or not app_complete(root):
|
||||
try:
|
||||
if not is_deb(image):
|
||||
raise Failure("app-format")
|
||||
extract_deb(image, staging)
|
||||
layer = os.path.join(staging, DESKTOP)
|
||||
os.makedirs(layer, exist_ok=True)
|
||||
for package in desktop:
|
||||
if not is_deb(package):
|
||||
raise Failure("desktop-format")
|
||||
extract_deb(package, layer, lambda name: name.startswith(DESKTOP_KEEP))
|
||||
icon = os.path.join(staging, DEB_ICON)
|
||||
if os.path.isfile(icon):
|
||||
shutil.copyfile(icon, os.path.join(staging, ICON))
|
||||
if not app_complete(staging):
|
||||
raise Failure("app-extract")
|
||||
except Exception:
|
||||
remove(staging)
|
||||
raise Failure("app-extract")
|
||||
raise
|
||||
remove(dest)
|
||||
os.rename(root, dest)
|
||||
remove(staging)
|
||||
os.rename(staging, dest)
|
||||
|
||||
|
||||
def app_complete(root):
|
||||
return os.path.isfile(os.path.join(root, "AppRun")) and os.path.isfile(os.path.join(root, "usr", "bin", "EpicGamesLauncher"))
|
||||
if not os.path.isfile(os.path.join(root, APP_BIN)):
|
||||
return False
|
||||
return os.path.isfile(os.path.join(root, "AppRun")) or os.path.isfile(os.path.join(root, DESKTOP_LIB, WEBKIT_LIB))
|
||||
|
||||
|
||||
def app_command(app_dir):
|
||||
apprun = os.path.join(app_dir, "AppRun")
|
||||
return apprun if os.path.isfile(apprun) else os.path.join(app_dir, APP_BIN)
|
||||
|
||||
|
||||
def desktop_libs(app_dir):
|
||||
path = os.path.join(app_dir, DESKTOP_LIB)
|
||||
return path if os.path.isdir(path) else None
|
||||
|
||||
|
||||
def link_webkit(files, libs):
|
||||
target = os.path.join(files, "lib", "x86_64-linux-gnu", WEBKIT_DIR)
|
||||
if os.path.isdir(target) and not os.path.islink(target):
|
||||
return
|
||||
source = os.path.join(libs, WEBKIT_DIR) if libs else None
|
||||
if source is None or not os.path.isdir(source):
|
||||
remove(target)
|
||||
return
|
||||
link = os.path.relpath(source, os.path.dirname(target))
|
||||
if os.path.islink(target) and os.readlink(target) == link:
|
||||
return
|
||||
remove(target)
|
||||
os.symlink(link, target)
|
||||
|
||||
|
||||
def ready(path):
|
||||
@@ -396,8 +475,11 @@ def install(options):
|
||||
image = options.get("app")
|
||||
if not image or not os.path.isfile(image):
|
||||
raise Failure("no-app-image")
|
||||
say("unpacking the Epic Games Launcher %s" % app)
|
||||
extract_app(image, app_dir)
|
||||
desktop = options.get("desktop") or []
|
||||
if not all(os.path.isfile(package) for package in desktop):
|
||||
raise Failure("no-desktop-package")
|
||||
say("unpacking the Epic Games Launcher %s (%d desktop packages)" % (app, len(desktop)))
|
||||
extract_app(image, app_dir, desktop)
|
||||
mark_ready(app_dir)
|
||||
if not ready(runtime_dir):
|
||||
tarball, deb = options.get("runtime"), options.get("gles")
|
||||
@@ -729,11 +811,13 @@ def fex_environment(fex, files, env):
|
||||
return result
|
||||
|
||||
|
||||
def client_environment(base, fex, files, display, bus, broker, a11y=None, hidden=False):
|
||||
def client_environment(base, fex, files, display, bus, broker, a11y=None, hidden=False, libs=None):
|
||||
env = {name: base[name] for name in KEPT_ENV if base.get(name)}
|
||||
env.setdefault("HOME", HOME)
|
||||
env.setdefault("LANG", "C.UTF-8")
|
||||
env["PATH"] = SHIMS + ":/usr/bin:/bin"
|
||||
if libs:
|
||||
env["LD_LIBRARY_PATH"] = libs
|
||||
env["DISPLAY"] = display
|
||||
env["DBUS_SESSION_BUS_ADDRESS"] = bus
|
||||
env[BROKER_ENV] = broker
|
||||
@@ -1238,6 +1322,8 @@ class Session:
|
||||
seed_settings()
|
||||
install_shims()
|
||||
install_preload(files)
|
||||
libs = desktop_libs(app_dir)
|
||||
link_webkit(files, libs)
|
||||
fex_module()["install_fonts"](files)
|
||||
clear_playing()
|
||||
sync_installations()
|
||||
@@ -1254,8 +1340,8 @@ class Session:
|
||||
path = broker_path()
|
||||
self.broker = Broker(path, self.mode, base)
|
||||
write_json(instance_file(), {"pid": os.getpid(), "mode": self.mode, "bus": bus, "broker": path})
|
||||
env = client_environment(base, fex, files, display, bus, path, self.a11y, hidden=self.mode == "hidden")
|
||||
self.command = [fex["bin"], os.path.join(app_dir, "AppRun")]
|
||||
env = client_environment(base, fex, files, display, bus, path, self.a11y, hidden=self.mode == "hidden", libs=libs)
|
||||
self.command = [fex["bin"], app_command(app_dir)]
|
||||
self.env = env
|
||||
say("starting the Epic Games Launcher %s (%s, display %s)" % (current.get("app"), self.mode, display))
|
||||
self.start_client()
|
||||
@@ -1471,12 +1557,14 @@ def forward(bus, url):
|
||||
return False
|
||||
|
||||
|
||||
def parse_options(args, flags=()):
|
||||
def parse_options(args, flags=(), lists=()):
|
||||
options, rest = {}, []
|
||||
while args:
|
||||
arg = args.pop(0)
|
||||
if arg.startswith("--") and arg[2:] in flags:
|
||||
options[arg[2:]] = True
|
||||
elif arg.startswith("--") and arg[2:] in lists and args:
|
||||
options.setdefault(arg[2:], []).append(args.pop(0))
|
||||
elif arg.startswith("--") and args:
|
||||
options[arg[2:]] = args.pop(0)
|
||||
else:
|
||||
@@ -1830,7 +1918,7 @@ def main(argv):
|
||||
if action == "xdg-open":
|
||||
return shim_open(args)
|
||||
if action == "install":
|
||||
options, _ = parse_options(args)
|
||||
options, _ = parse_options(args, lists=("desktop",))
|
||||
try:
|
||||
return install(options)
|
||||
except (ValueError, tarfile.TarError, OSError) as error:
|
||||
|
||||
@@ -175,17 +175,27 @@ class RuntimeExtractTest(EpicTestCase):
|
||||
old = self.state / "app/0.1"
|
||||
old.mkdir(parents=True)
|
||||
|
||||
def extract_app(image, dest):
|
||||
os.makedirs(os.path.join(dest, "usr/bin"))
|
||||
Path(dest, "AppRun").write_text("run")
|
||||
Path(dest, "usr/bin/EpicGamesLauncher").write_text("bin")
|
||||
layers = []
|
||||
|
||||
def extract_app(image, dest, desktop=()):
|
||||
layers.append(list(desktop))
|
||||
os.makedirs(os.path.join(dest, "usr/bin"))
|
||||
os.makedirs(os.path.join(dest, "desktop/usr/lib/x86_64-linux-gnu"))
|
||||
Path(dest, "usr/bin/EpicGamesLauncher").write_text("bin")
|
||||
Path(dest, "desktop/usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.1.so.0").write_text("webkit")
|
||||
|
||||
package = self.tmp / "libwebkit.deb"
|
||||
package.write_bytes(b"x")
|
||||
with mock.patch.dict(G, {"extract_app": extract_app, "fex_tool": lambda request=False: {"bin": "/fex", "server": "/s"}}), \
|
||||
mock.patch("sys.stdout", new_callable=io.StringIO) as out:
|
||||
image = self.tmp / "image"
|
||||
image.write_bytes(b"x")
|
||||
with self.assertRaises(G["Failure"]):
|
||||
G["install"]({"app": str(image), "app-version": "0.95.2+g1", "runtime": str(tarball),
|
||||
"runtime-version": "4.0.1", "gles": str(deb), "desktop": [str(self.tmp / "missing.deb")]})
|
||||
code = G["install"]({"app": str(image), "app-version": "0.95.2+g1", "runtime": str(tarball),
|
||||
"runtime-version": "4.0.1", "gles": str(deb)})
|
||||
"runtime-version": "4.0.1", "gles": str(deb), "desktop": [str(package)]})
|
||||
self.assertEqual([[str(package)]], layers)
|
||||
self.assertEqual(0, code)
|
||||
report = json.loads(out.getvalue())
|
||||
self.assertTrue(report["installed"])
|
||||
@@ -197,6 +207,122 @@ class RuntimeExtractTest(EpicTestCase):
|
||||
self.assertTrue((self.state / "app/0.95.2+g1/.droiddeck-ready").is_file())
|
||||
|
||||
|
||||
def deb(path, entries, compression="gz"):
|
||||
data = io.BytesIO()
|
||||
with tarfile.open(fileobj=data, mode="w:" + compression) as archive:
|
||||
for entry in entries:
|
||||
tar_add(archive, *entry[:1], **entry[1])
|
||||
path.write_bytes(ar([("debian-binary", b"2.0\n"), ("control.tar.xz", b"c"), ("data.tar." + compression, data.getvalue())]))
|
||||
return path
|
||||
|
||||
|
||||
class LauncherDebTest(EpicTestCase):
|
||||
def launcher(self):
|
||||
return deb(self.tmp / "EpicGamesLauncher-x86_64.deb", [
|
||||
("./usr", {"kind": "dir"}),
|
||||
("./usr/bin/EpicGamesLauncher", {"data": b"egl", "mode": 0o755}),
|
||||
("./usr/lib/epic-games-launcher/libEOSSDK-Linux-Shipping.so", {"data": b"eos"}),
|
||||
("./usr/share/icons/hicolor/256x256@2/apps/EpicGamesLauncher.png", {"data": b"png"}),
|
||||
("./usr/share/applications/epic-games-launcher.desktop", {"data": b"[Desktop Entry]\n"}),
|
||||
("./usr/bin/egl", {"link": "/usr/bin/EpicGamesLauncher"}),
|
||||
("../escape", {"data": b"x"}),
|
||||
])
|
||||
|
||||
def webkit(self):
|
||||
return deb(self.tmp / "libwebkit2gtk-4.1-0_amd64.deb", [
|
||||
("./usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.1.so.0.19.1", {"data": b"webkit"}),
|
||||
("./usr/lib/x86_64-linux-gnu/libwebkit2gtk-4.1.so.0", {"link": "libwebkit2gtk-4.1.so.0.19.1"}),
|
||||
("./usr/lib/x86_64-linux-gnu/webkit2gtk-4.1/WebKitNetworkProcess", {"data": b"net", "mode": 0o755}),
|
||||
("./usr/lib/x86_64-linux-gnu/webkit2gtk-4.1/injected-bundle/libwebkit2gtkinjectedbundle.so", {"data": b"bundle"}),
|
||||
("./usr/share/doc/libwebkit2gtk-4.1-0/copyright", {"data": b"c"}),
|
||||
("./usr/share/locale/fr/LC_MESSAGES/WebKitGTK-4.1.mo", {"data": b"fr"}),
|
||||
], "xz")
|
||||
|
||||
def test_the_launcher_and_its_desktop_layer_come_out_of_debs(self):
|
||||
dest = self.state / "app/0.113.0+g1"
|
||||
G["extract_app"](str(self.launcher()), str(dest), [str(self.webkit())])
|
||||
self.assertEqual(b"egl", (dest / "usr/bin/EpicGamesLauncher").read_bytes())
|
||||
self.assertTrue(os.access(dest / "usr/bin/EpicGamesLauncher", os.X_OK))
|
||||
self.assertEqual(b"eos", (dest / "usr/lib/epic-games-launcher/libEOSSDK-Linux-Shipping.so").read_bytes())
|
||||
self.assertEqual("EpicGamesLauncher", os.readlink(dest / "usr/bin/egl"))
|
||||
self.assertEqual(b"png", (dest / "epic-games-launcher.png").read_bytes())
|
||||
libs = dest / "desktop/usr/lib/x86_64-linux-gnu"
|
||||
self.assertEqual(b"webkit", (libs / "libwebkit2gtk-4.1.so.0").read_bytes())
|
||||
self.assertEqual(b"net", (libs / "webkit2gtk-4.1/WebKitNetworkProcess").read_bytes())
|
||||
self.assertFalse((dest / "desktop/usr/share").exists())
|
||||
self.assertFalse((self.state / "app/escape").exists())
|
||||
self.assertFalse((self.state / "app/0.113.0+g1.staging").exists())
|
||||
self.assertTrue(G["app_complete"](str(dest)))
|
||||
self.assertEqual(str(dest / "usr/bin/EpicGamesLauncher"), G["app_command"](str(dest)))
|
||||
self.assertEqual(str(libs), G["desktop_libs"](str(dest)))
|
||||
|
||||
def test_a_launcher_without_its_desktop_layer_is_refused(self):
|
||||
dest = self.state / "app/0.113.0+g1"
|
||||
with self.assertRaises(G["Failure"]) as caught:
|
||||
G["extract_app"](str(self.launcher()), str(dest))
|
||||
self.assertEqual("app-extract", str(caught.exception))
|
||||
self.assertFalse(dest.exists())
|
||||
self.assertFalse(Path(str(dest) + ".staging").exists())
|
||||
|
||||
def test_anything_but_a_deb_is_refused_and_leaves_nothing_behind(self):
|
||||
image = self.tmp / "EpicGamesLauncher-x86_64.AppImage"
|
||||
image.write_bytes(b"\x7fELF\x02\x01\x01\x00AI\x02" + bytes(64))
|
||||
dest = self.state / "app/0.95.2+g1"
|
||||
with self.assertRaises(G["Failure"]) as caught:
|
||||
G["extract_app"](str(image), str(dest), [str(self.webkit())])
|
||||
self.assertEqual("app-format", str(caught.exception))
|
||||
plain = self.tmp / "plain.deb"
|
||||
plain.write_bytes(ar([("data.tar.gz", b"x")]))
|
||||
with self.assertRaises(G["Failure"]) as caught:
|
||||
G["extract_app"](str(self.launcher()), str(dest), [str(plain)])
|
||||
self.assertEqual("desktop-format", str(caught.exception))
|
||||
self.assertFalse(dest.exists())
|
||||
self.assertFalse(Path(str(dest) + ".staging").exists())
|
||||
|
||||
def test_an_installed_appimage_launcher_still_runs_through_apprun(self):
|
||||
app = self.state / "app/0.95.2+g1"
|
||||
(app / "usr/bin").mkdir(parents=True)
|
||||
(app / "AppRun").write_text("run")
|
||||
(app / "usr/bin/EpicGamesLauncher").write_text("bin")
|
||||
self.assertTrue(G["app_complete"](str(app)))
|
||||
self.assertEqual(str(app / "AppRun"), G["app_command"](str(app)))
|
||||
self.assertIsNone(G["desktop_libs"](str(app)))
|
||||
(app / "usr/bin/EpicGamesLauncher").unlink()
|
||||
self.assertFalse(G["app_complete"](str(app)))
|
||||
|
||||
def test_the_webkit_helpers_are_linked_into_the_runtime(self):
|
||||
dest = self.state / "app/0.113.0+g1"
|
||||
G["extract_app"](str(self.launcher()), str(dest), [str(self.webkit())])
|
||||
files = self.state / "runtime/4.0.1/files"
|
||||
(files / "lib/x86_64-linux-gnu").mkdir(parents=True)
|
||||
link = files / "lib/x86_64-linux-gnu/webkit2gtk-4.1"
|
||||
G["link_webkit"](str(files), G["desktop_libs"](str(dest)))
|
||||
self.assertFalse(os.path.isabs(os.readlink(link)))
|
||||
self.assertEqual(b"net", (link / "WebKitNetworkProcess").read_bytes())
|
||||
G["link_webkit"](str(files), G["desktop_libs"](str(dest)))
|
||||
self.assertEqual(b"net", (link / "WebKitNetworkProcess").read_bytes())
|
||||
G["link_webkit"](str(files), None)
|
||||
self.assertFalse(os.path.lexists(link))
|
||||
link.mkdir()
|
||||
(link / "own").write_text("x")
|
||||
G["link_webkit"](str(files), G["desktop_libs"](str(dest)))
|
||||
self.assertTrue((link / "own").is_file())
|
||||
self.assertTrue((dest / "desktop/usr/lib/x86_64-linux-gnu/webkit2gtk-4.1/WebKitNetworkProcess").is_file())
|
||||
|
||||
def test_only_the_deb_launcher_gets_the_desktop_libraries(self):
|
||||
with mock.patch.dict(G, {"fex_environment": lambda fex, files, base: {}}):
|
||||
plain = G["client_environment"]({"LD_LIBRARY_PATH": "/host"}, None, None, ":0", "bus", "broker")
|
||||
layered = G["client_environment"]({}, None, None, ":0", "bus", "broker", libs="/app/desktop/usr/lib/x86_64-linux-gnu")
|
||||
self.assertNotIn("LD_LIBRARY_PATH", plain)
|
||||
self.assertEqual("/app/desktop/usr/lib/x86_64-linux-gnu", layered["LD_LIBRARY_PATH"])
|
||||
|
||||
def test_every_desktop_package_reaches_the_install(self):
|
||||
options, rest = G["parse_options"](["--app", "a.deb", "--desktop", "one.deb", "--desktop", "two.deb", "x"], lists=("desktop",))
|
||||
self.assertEqual({"app": "a.deb", "desktop": ["one.deb", "two.deb"]}, options)
|
||||
self.assertEqual(["x"], rest)
|
||||
self.assertEqual({"desktop": "two.deb"}, G["parse_options"](["--desktop", "one.deb", "--desktop", "two.deb"])[0])
|
||||
|
||||
|
||||
class ArgumentsTest(EpicTestCase):
|
||||
def test_client_arguments_win_and_paths_become_windows_paths(self):
|
||||
ovt = self.tmp / "ovt"
|
||||
|
||||
Reference in new issue
Block a user