fix(epic): install the Epic Games Launcher from its Linux .deb (#2281)

* 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>

* fix(epic): provide desktop GLib data paths

* fix(epic): keep archive symlinks from redirecting the desktop layer and icon

---------

Co-authored-by: zooluis <150430329+zooluis@users.noreply.github.com>
This commit is contained in:
MaxsTechReviewandzooluis authored and GitHub committed 2026-11-14 16:53:43 -05:00
1 parent 87c571f443
commit a3be5f7ae2
5 files changed
+417 -101

No files matched your search

@@ -21,19 +21,61 @@ import java.security.MessageDigest
import java.util.concurrent.atomic.AtomicBoolean
internal object EpicClientSources {
const val LAUNCHER_URL = "https://launcher-public-service-prod06.ol.epicgames.com/launcher/api/installer/download/EpicGamesLauncher-x86_64.AppImage"
const val LAUNCHER_FILE = "EpicGamesLauncher-x86_64.AppImage"
const val LAUNCHER_URL = "https://launcher-public-service-prod06.ol.epicgames.com/launcher/api/installer/download/EpicGamesLauncher-x86_64.deb"
const val LAUNCHER_FILE = "EpicGamesLauncher-x86_64.deb"
const val RUNTIME_BASE = "https://repo.steampowered.com/steamrt4/images/"
const val RUNTIME_FILE = "com.valvesoftware.SteamRuntime.Platform-amd64,i386-steamrt4-runtime.tar.gz"
const val GLES_URL = "https://deb.debian.org/debian/pool/main/libg/libglvnd/libgles2_1.7.0-1+b2_amd64.deb"
const val GLES_FILE = "libgles2_1.7.0-1+b2_amd64.deb"
const val GLES_SHA256 = "e12c18aa77939d122ee1dea520ba0440b97dc19200b7396e03dff03a3ece74c1"
const val DEBIAN = "https://deb.debian.org/debian/"
const val SNAPSHOT = "https://snapshot.debian.org/archive/debian/20261101T000000Z/"
const val USER_AGENT = "DroidDeck"
private val VERSION = Regex("[A-Za-z0-9._+-]{1,64}")
private val SUM = Regex("^([0-9a-fA-F]{64})\\s+\\*?(.+)$")
class Source(val url: String, val version: String, val sha256: String? = null)
class Package(val path: String, val sha256: String, val size: Long) {
val file: String get() = path.substringAfterLast('/')
val urls: List<String> get() = listOf(DEBIAN + path, SNAPSHOT + path)
}
val DESKTOP = listOf(
Package("pool/main/a/abseil/libabsl20240722_20240722.0-4_amd64.deb", "78c6d7692890990a27cb1d5bbd95b7bfe47a4183ffafec5b30f689f9b58ec6f7", 491548L),
Package("pool/main/a/aom/libaom3_3.12.1-1+deb13u1_amd64.deb", "743eec7c94ae30295bc557ebac3dfae948e7390e89a2743c585d56297e9d312e", 1871712L),
Package("pool/main/a/aspell/libaspell15_0.60.8.1-4_amd64.deb", "8be22785198a4e5de1e2c3a157e8cd99ec7d5843c8ac96a174ec701ba4ac28e2", 337684L),
Package("pool/main/a/at-spi2-core/libatk-bridge2.0-0t64_2.56.2-1+deb13u2_amd64.deb", "c0fe87ea1bdca2f938eaa8286af5ad38ecd15cf18c6cfb5961d7d46ac3192325", 68516L),
Package("pool/main/a/at-spi2-core/libatspi2.0-0t64_2.56.2-1+deb13u2_amd64.deb", "65e9c9ecbd820fba2d04104cddd0bad33d256cbdfe0d1cb5365f10e363df2315", 81056L),
Package("pool/main/liba/libavif/libavif16_1.2.1-1.2_amd64.deb", "ba6c334454d3562560ad583fbe2c998e203b0fc5a0e0e91112ddcd3cff4704bb", 133120L),
Package("pool/main/libc/libcloudproviders/libcloudproviders0_0.3.6-2_amd64.deb", "a626bb23ed9ebc4bc3ce446b552048de63d76768bf0fb492754965c5ee28a7e4", 29232L),
Package("pool/main/c/colord/libcolord2_1.4.7-3_amd64.deb", "f11fd3b492781122edf0790f1e1fe24c51a41c67d4bb76cff84a9426c5654fa7", 139204L),
Package("pool/main/e/enchant-2/libenchant-2-2_2.8.2+dfsg1-3_amd64.deb", "83f208d89db1c48e6ede8a23e8ffa2bcddd4f99427bfd1279201247bbf27ca58", 56756L),
Package("pool/main/libe/libepoxy/libepoxy0_1.5.10-2_amd64.deb", "4c4c8024f2175086de65bca9fdc3fbb967f2863ebf249d489c66d0c8103dd3a3", 192728L),
Package("pool/main/libe/libevdev/libevdev2_1.13.4+dfsg-1_amd64.deb", "02e85fb9461b85b23f775d5fcf5a31c55d37bec40b63fd98ca5d3a2763714ae7", 32372L),
Package("pool/main/f/flite/libflite1_2.2-7_amd64.deb", "5945190970be7d4a1f71fb6f7e3e340ba2675e770605df0754051d617a6c5ee6", 12811404L),
Package("pool/main/libg/libgav1/libgav1-1_0.19.0-3+b1_amd64.deb", "94010041e59c7a8d2d3d1f5e62afd523f002b7b1caa3189419160b66d71c0195", 352956L),
Package("pool/main/g/gst-plugins-base1.0/libgstreamer-gl1.0-0_1.26.2-1+deb13u1_amd64.deb", "efacc61acbd44a6a067612e4592b9fe81efdc5011ed4c6cf7afd8ed83c5f834a", 269984L),
Package("pool/main/g/gst-plugins-base1.0/libgstreamer-plugins-base1.0-0_1.26.2-1+deb13u1_amd64.deb", "a20aedb3f89c162b4859cec37076f4eba54b0bcc7e5cb254a26cc4a877a88a1e", 997404L),
Package("pool/main/g/gstreamer1.0/libgstreamer1.0-0_1.26.2-2_amd64.deb", "08b463307fbde5496a346b1bb300b465cd22bd326f6f4634f482bf441af28a9b", 1421116L),
Package("pool/main/g/gtk+3.0/libgtk-3-0t64_3.24.49-3_amd64.deb", "4aa8828f01365f937f3bf69f812c8107ee4c8a2b208ffdd7656e8de5de81d98f", 2768812L),
Package("pool/main/h/hidapi/libhidapi-hidraw0_0.14.0-1+b2_amd64.deb", "89c546cb55be403ce63fe668baff2515979100a30fa07e2b97de186b9c07f01e", 12664L),
Package("pool/main/h/hunspell/libhunspell-1.7-0_1.7.2+really1.7.2-10+b4_amd64.deb", "a9427e5220e71f8c04c6c0f87826c6fef98e2bab6994a87d6d82e8a120790ecf", 236980L),
Package("pool/main/h/highway/libhwy1t64_1.2.0-2+b2_amd64.deb", "540c4ff28255fbfa89468061b722dfc2b773b0c1ecf163a063202482dea5b119", 676044L),
Package("pool/main/h/hyphen/libhyphen0_2.8.8-7+b2_amd64.deb", "fa9dca7b8cf1381fd52800c44a385c5725a78a88bd705f7c39b1046a5293435e", 30664L),
Package("pool/main/w/webkit2gtk/libjavascriptcoregtk-4.1-0_2.52.6-1~deb13u1_amd64.deb", "3383ebb3e13f31225c65f41112420be58493a3de112b5993cf5c417cfedc47c8", 7511632L),
Package("pool/main/j/jpeg-xl/libjxl0.11_0.11.2-0.1~deb13u2_amd64.deb", "cd1ca3a52cb0d8fdce1d994bcbf0663de28c64add1cfe8096639ae8fa9808824", 1133312L),
Package("pool/main/l/lcms2/liblcms2-2_2.16-2+deb13u2_amd64.deb", "32e53c2002ccea8c60c02779bea0ba49ac132fef702988a30d64af79b6617806", 160264L),
Package("pool/main/libm/libmanette/libmanette-0.2-0_0.2.12-1_amd64.deb", "98841a467692c46fd1870275113235691ebbfe71a3524f6b2a0fa7e9c33c6e56", 43752L),
Package("pool/main/o/orc/liborc-0.4-0t64_0.4.41-1_amd64.deb", "5b9afe78be0dd71399c0d4d7e5f26beb6ddf207279997942d8280be1b20bd58c", 189604L),
Package("pool/main/r/rust-rav1e/librav1e0.7_0.7.1-9+b2_amd64.deb", "d5b1373a8d6905ee4523faf1db7a626dc660e03836ec91b616e57ba386f47eb6", 946396L),
Package("pool/main/libs/libsecret/libsecret-1-0_0.21.7-1_amd64.deb", "949c5428cd3427486ac6c4dfc6d9400ce786c504c02334acc903c873aa52d14f", 111224L),
Package("pool/main/s/svt-av1/libsvtav1enc2_2.3.0+dfsg-1_amd64.deb", "cdaf961c3cc4fe78a19ff18c17d83d813f78a378fdcc4c86ccbb9b54e84ae599", 2489492L),
Package("pool/main/w/webkit2gtk/libwebkit2gtk-4.1-0_2.52.6-1~deb13u1_amd64.deb", "6471d989a61a56a7801e88e420789aa6b0eaba630a9787365bba8b9576b7ba1c", 24163372L),
Package("pool/main/libx/libxslt/libxslt1.1_1.1.35-1.2+deb13u3_amd64.deb", "c8e5a745ca3afaa079b01e0c00d80a241101d1ab840407fcd4bb423de3326160", 233128L),
Package("pool/main/liby/libyuv/libyuv0_0.0.1904.20250204-1_amd64.deb", "1a6827fe94fa5572a032332df7313ed408e9c0ad78f3a1248391bddc6d920ef2", 173700L),
)
fun launcher(): Source? {
val location = redirect(LAUNCHER_URL) ?: return null
val version = launcherVersion(location) ?: return null
@@ -142,12 +184,13 @@ internal object EpicClientSources {
private fun hex(bytes: ByteArray): String = bytes.joinToString("") { "%02x".format(it) }
fun isAppImage(file: File): Boolean = runCatching {
private val DEB_MAGIC = "!<arch>\ndebian-binary".toByteArray(Charsets.US_ASCII)
fun isDeb(file: File): Boolean = runCatching {
RandomAccessFile(file, "r").use { raf ->
val head = ByteArray(11)
val head = ByteArray(DEB_MAGIC.size)
raf.readFully(head)
head[0] == 0x7f.toByte() && head[1] == 'E'.code.toByte() && head[2] == 'L'.code.toByte() && head[3] == 'F'.code.toByte() &&
head[8] == 'A'.code.toByte() && head[9] == 'I'.code.toByte() && head[10] == 2.toByte()
head.contentEquals(DEB_MAGIC)
}
}.getOrDefault(false)
}
@@ -156,9 +199,10 @@ internal class EpicClientInstaller(private val app: Context) : DownloadQueue.Dow
private val cancelled = AtomicBoolean(false)
@Volatile private var connection: HttpURLConnection? = null
private class Part(val url: String, val file: File, val sha256: String?, val appImage: Boolean) {
var size = -1L
private class Part(val urls: List<String>, val file: File, val sha256: String?, val launcher: Boolean, var size: Long = -1L) {
var mirror = 0
var mismatch: String? = null
val url: String get() = urls[mirror]
}
override fun run(handle: DownloadQueue.JobHandle): String? {
@@ -173,17 +217,15 @@ internal class EpicClientInstaller(private val app: Context) : DownloadQueue.Dow
val needRuntime = !(before.runtimeVersion == runtime.version && File(state, "runtime/${runtime.version}/.droiddeck-ready").isFile)
val dir = EpicClient.downloadsDir(app).apply { mkdirs() }
val gles = EpicClientSources.gles()
val parts = buildList {
if (needApp) add(Part(launcher.url, File(dir, "${launcher.version}-${EpicClientSources.LAUNCHER_FILE}"), null, true))
if (needRuntime) {
add(Part(runtime.url, File(dir, "steamrt4-${runtime.version}.tar.gz"), runtime.sha256, false))
add(Part(gles.url, File(dir, EpicClientSources.GLES_FILE), gles.sha256, false))
}
}
val appPart = if (needApp) Part(listOf(launcher.url), File(dir, "${launcher.version}-${EpicClientSources.LAUNCHER_FILE}"), null, true) else null
val desktopParts = if (needApp) EpicClientSources.DESKTOP.map { Part(it.urls, File(dir, it.file), it.sha256, false, it.size) } else emptyList()
val runtimePart = if (needRuntime) Part(listOf(runtime.url), File(dir, "steamrt4-${runtime.version}.tar.gz"), runtime.sha256, false) else null
val glesPart = if (needRuntime) Part(listOf(gles.url), File(dir, EpicClientSources.GLES_FILE), gles.sha256, false) else null
val parts = listOfNotNull(appPart) + desktopParts + listOfNotNull(runtimePart, glesPart)
val keep = parts.flatMap { listOf(it.file.name, it.file.name + PARTIAL, it.file.name + TAG) }.toSet()
dir.listFiles()?.forEach { if (it.name !in keep) it.deleteRecursively() }
if (parts.isNotEmpty()) {
parts.forEach { it.size = length(it.url) }
parts.forEach { if (it.size <= 0) it.size = length(it.url) }
val total = parts.sumOf { it.size.coerceAtLeast(0L) }
val have = parts.sumOf { p -> if (p.file.isFile) p.file.length() else File(p.file.path + PARTIAL).length() }
val needed = (total - have).coerceAtLeast(0L) + (if (needApp) APP_ROOM else 0L) + (if (needRuntime) RUNTIME_ROOM else 0L)
@@ -202,8 +244,9 @@ internal class EpicClientInstaller(private val app: Context) : DownloadQueue.Dow
handle.stage(DownloadStage.INSTALL, app.getString(R.string.epic_client_unpacking))
val argv = mutableListOf(EpicClient.PROGRAM, "install", "--app-version", launcher.version, "--runtime-version", runtime.version)
fun guest(file: File) = EpicClient.guestPath(app, file) ?: throw IllegalStateException(app.getString(R.string.epic_client_unpack_failed, file.name))
if (needApp) argv += listOf("--app", guest(parts[0].file))
if (needRuntime) argv += listOf("--runtime", guest(parts[parts.size - 2].file), "--gles", guest(parts[parts.size - 1].file))
appPart?.let { argv += listOf("--app", guest(it.file)) }
desktopParts.forEach { argv += listOf("--desktop", guest(it.file)) }
if (runtimePart != null && glesPart != null) argv += listOf("--runtime", guest(runtimePart.file), "--gles", guest(glesPart.file))
var answer: JSONObject? = null
val code = GuestCommand.run(app, argv, fakeRoot = true, logName = "epic-client") { line ->
if (line.startsWith("{")) runCatching { JSONObject(line) }.getOrNull()?.let { answer = it }
@@ -298,6 +341,10 @@ internal class EpicClientInstaller(private val app: Context) : DownloadQueue.Dow
}
200 -> false
416 -> { partial.delete(); tag.delete(); throw IOException("HTTP 416") }
404, 410 -> {
if (part.mirror + 1 < part.urls.size) { part.mirror++; tag.delete() }
throw IOException("HTTP $code")
}
else -> throw IOException("HTTP $code")
}
val served = conn.getHeaderField("ETag")?.takeIf { it.isNotBlank() }
@@ -334,8 +381,8 @@ internal class EpicClientInstaller(private val app: Context) : DownloadQueue.Dow
part.sha256?.let { want ->
if (EpicClientSources.sha256(file) != want) { file.delete(); throw IOException("checksum mismatch") }
}
if (part.appImage) {
if (!EpicClientSources.isAppImage(file)) { file.delete(); throw IOException("not an AppImage") }
if (part.launcher) {
if (!EpicClientSources.isDeb(file)) { file.delete(); throw IOException("not a Debian package") }
if (EpicClientSources.etagMatches(file, etag) == false) {
val seen = EpicClientSources.sha256(file)
if (part.mismatch != seen) {
@@ -351,7 +398,7 @@ internal class EpicClientInstaller(private val app: Context) : DownloadQueue.Dow
const val PARTIAL = ".part"
const val TAG = ".etag"
const val ATTEMPTS = 6
const val APP_ROOM = 600L shl 20
const val APP_ROOM = 700L shl 20
const val RUNTIME_ROOM = 560L shl 20
}
}