mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 05:46:03 +00:00
fix(fex): x86 programs use DroidDeck's own FEX build, kept to the catalog's version
This commit is contained in:
1 parent
5bdf0d6b04
commit
7e2d13b641
10 files changed
+142
-82
No files matched your search
@@ -27,6 +27,8 @@ PRELOADS = "/usr/local/lib/droiddeck-fex"
|
||||
URUNTIME = "/usr/local/lib/droiddeck/uruntime"
|
||||
HOST_PRELOAD = "/etc/ld.so.preload"
|
||||
FEX_APPID = "3127680"
|
||||
OWN_FEX = "/usr/local"
|
||||
OWN_FEX_TAG = os.path.join(OWN_FEX, "share", "fex-emu", ".droiddeck-tag")
|
||||
SNIPER_APPID = "1628350"
|
||||
SLR4_APPID = "4183110"
|
||||
INSTALL_DIRS = {FEX_APPID: "FEX-Emu", SNIPER_APPID: "SteamLinuxRuntime_sniper", SLR4_APPID: "SteamLinuxRuntime_4"}
|
||||
@@ -152,8 +154,21 @@ def first_dir(prefix, candidates):
|
||||
return None
|
||||
|
||||
|
||||
def update_own_fex():
|
||||
wanted = os.environ.get("BL_FEX_TAG")
|
||||
if not wanted:
|
||||
return
|
||||
if (read_text(OWN_FEX_TAG) or "").strip() == wanted and os.access(os.path.join(OWN_FEX, "bin", "FEX"), os.X_OK):
|
||||
return
|
||||
say("installing DroidDeck's FEX build %s" % wanted)
|
||||
if subprocess.call([os.path.join(BIN_DIR, "droiddeck-fex-update")], stdout=sys.stderr) != 0:
|
||||
say("DroidDeck's FEX build %s did not install; using the FEX already here" % wanted)
|
||||
|
||||
|
||||
def fex_install():
|
||||
prefixes = []
|
||||
if os.path.isfile(OWN_FEX_TAG):
|
||||
prefixes.append((OWN_FEX, False))
|
||||
tool = app_dir(FEX_APPID)
|
||||
if tool:
|
||||
prefixes += [(os.path.join(tool, sub), True) for sub in ("usr", "", "files/usr", "files")]
|
||||
@@ -445,6 +460,7 @@ def describe(fex, platform, graphics=None):
|
||||
|
||||
def prepare(app=SNIPER_APPID):
|
||||
with locked():
|
||||
update_own_fex()
|
||||
fex = fex_install()
|
||||
platform = runtime_platform(app)
|
||||
status = describe(fex, platform)
|
||||
@@ -730,6 +746,7 @@ def extracted():
|
||||
|
||||
def want_fex():
|
||||
with locked():
|
||||
update_own_fex()
|
||||
status = describe(fex_install(), runtime_platform(), graphics_platform())
|
||||
if not status["ready"]:
|
||||
request_install()
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
#!/bin/bash
|
||||
FEX_TAG=fex-2610-r5
|
||||
FEX_SHA256=0fc1ca2ba13817ad70d1ea157119a75c9c02446b57d166e6d676cce0807c19c4
|
||||
FEX_URL=https://github.com/Droid-Deck/DroidDeck-Components/releases/download/$FEX_TAG/fex.tzst
|
||||
|
||||
# Whether every program in the FEX tree at $1 finds its libraries (r4 did not without libxxhash).
|
||||
fex_loads() {
|
||||
local b out
|
||||
for b in FEX FEXServer unsquashfs; do
|
||||
out=$(/usr/lib/ld-linux-aarch64.so.1 --list "$1/usr/local/bin/$b" 2>&1) && ! grep -q "not found" <<<"$out" && continue
|
||||
echo "== FEX check: $b: $(grep -E "not found|error" <<<"$out" | tr -s '\t ' ' ' | tr '\n' ';')" >&2
|
||||
return 1
|
||||
done
|
||||
}
|
||||
|
||||
# Installs one FEX build only once its archive matches the sha256 and it loads. The files it replaces are kept
|
||||
# until the installed copy loads too, and put back otherwise; the tag is written last.
|
||||
fex_install() {
|
||||
local tag=$1 sha=$2 urls=$3 dst=/ tmp u f
|
||||
tmp=$(mktemp -d)
|
||||
for u in $urls; do
|
||||
curl -fsSL --retry 2 "$u" -o "$tmp/fex.tzst" && echo "$sha $tmp/fex.tzst" | sha256sum -c --quiet >/dev/null 2>&1 && break
|
||||
rm -f "$tmp/fex.tzst"
|
||||
done
|
||||
if [ ! -s "$tmp/fex.tzst" ]; then
|
||||
echo "== FEX $tag: no source gave the archive with sha256 ${sha:0:12}" >&2
|
||||
rm -rf "$tmp"
|
||||
return 1
|
||||
fi
|
||||
if ! { mkdir "$tmp/root" && zstd -dc "$tmp/fex.tzst" | tar -C "$tmp/root" -x && fex_loads "$tmp/root"; }; then
|
||||
rm -rf "$tmp"
|
||||
return 1
|
||||
fi
|
||||
(cd "$tmp/root" && find . ! -type d) > "$tmp/files"
|
||||
mkdir "$tmp/old"
|
||||
while IFS= read -r f; do
|
||||
f=${f#./}
|
||||
if [ -e "$dst$f" ] || [ -L "$dst$f" ]; then
|
||||
cp -a --parents "$dst$f" "$tmp/old" || { echo "== FEX $tag: could not keep $dst$f aside" >&2; rm -rf "$tmp"; return 1; }
|
||||
fi
|
||||
done < "$tmp/files"
|
||||
if tar -C "$tmp/root" -c . | tar -C "$dst" -x && fex_loads "$dst" &&
|
||||
mkdir -p "${dst}usr/local/share/fex-emu" && echo "$tag" > "${dst}usr/local/share/fex-emu/.droiddeck-tag"; then
|
||||
rm -rf "$tmp"
|
||||
return 0
|
||||
fi
|
||||
echo "== FEX $tag: the installed copy did not load or its tag was not written; putting the previous files back" >&2
|
||||
while IFS= read -r f; do
|
||||
f=${f#./}
|
||||
[ -e "$tmp/old/$dst$f" ] || [ -L "$tmp/old/$dst$f" ] || rm -f "$dst$f"
|
||||
done < "$tmp/files"
|
||||
tar -C "$tmp/old$dst" -c . | tar -C "$dst" -x || echo "== FEX $tag: could not put the previous files back" >&2
|
||||
rm -rf "$tmp"
|
||||
return 1
|
||||
}
|
||||
|
||||
# The build DroidDeck-Components' fex.json names (the app passes it as BL_FEX_*) comes first, then a working
|
||||
# installed one, then FEX_TAG above. Sets FEX_NOW and FEX_FROM.
|
||||
fex_ready() {
|
||||
local have ok=
|
||||
have=$(cat /usr/local/share/fex-emu/.droiddeck-tag 2>/dev/null || true)
|
||||
[ -x /usr/local/bin/FEX ] && fex_loads / && ok=1
|
||||
if [ -n "${BL_FEX_TAG:-}" ]; then
|
||||
if [ -n "$ok" ] && [ "$have" = "$BL_FEX_TAG" ]; then FEX_NOW=$have FEX_FROM=catalog; return 0; fi
|
||||
step "downloading FEX ($BL_FEX_TAG)"
|
||||
if fex_install "$BL_FEX_TAG" "${BL_FEX_SHA256:-}" "${BL_FEX_URLS:-}"; then FEX_NOW=$BL_FEX_TAG FEX_FROM=catalog; return 0; fi
|
||||
if [ -n "$ok" ]; then FEX_NOW=$have FEX_FROM="kept; $BL_FEX_TAG did not install"; return 0; fi
|
||||
fi
|
||||
if [ -n "$ok" ] && [ "$have" = "$FEX_TAG" ]; then FEX_NOW=$have FEX_FROM=built-in; return 0; fi
|
||||
step "downloading FEX ($FEX_TAG)"
|
||||
if fex_install "$FEX_TAG" "$FEX_SHA256" "$FEX_URL"; then FEX_NOW=$FEX_TAG FEX_FROM=built-in; return 0; fi
|
||||
if [ -n "$ok" ]; then FEX_NOW=$have FEX_FROM="kept; $FEX_TAG did not install"; return 0; fi
|
||||
return 1
|
||||
}
|
||||
|
||||
if [ "${BASH_SOURCE[0]}" = "$0" ]; then
|
||||
set -eu
|
||||
step() { echo "== STEP $*" >&2; }
|
||||
fex_ready || exit 1
|
||||
echo "$FEX_NOW ($FEX_FROM)"
|
||||
fi
|
||||
@@ -1,8 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
FEX_TAG=fex-2610-r5
|
||||
FEX_SHA256=0fc1ca2ba13817ad70d1ea157119a75c9c02446b57d166e6d676cce0807c19c4
|
||||
FEX_URL=https://github.com/Droid-Deck/DroidDeck-Components/releases/download/$FEX_TAG/fex.tzst
|
||||
ROOTFS_URL=https://github.com/Droid-Deck/DroidDeck-Components/releases/download/fex-rootfs-ubuntu-24.04-2026-08-11/Ubuntu_24_04.sqsh
|
||||
ROOTFS_SHA256=2854b06d3ff1b8f6e526135bfb6dd5b7b30ab3ab73e79ae933a3d9fed959a178
|
||||
CDN=https://client-update.fastly.steamstatic.com
|
||||
@@ -18,6 +15,7 @@ ARM_STEAM=${XDG_DATA_HOME:-$REAL_HOME/.local/share}/Steam
|
||||
LOG=$X64_HOME/steam-x64.log
|
||||
mkdir -p "$X64_HOME"
|
||||
step() { echo "== STEP $(date -u +%H:%M:%S) $*" | tee -a "$LOG"; }
|
||||
. "${BASH_SOURCE[0]%/*}/droiddeck-fex-update"
|
||||
|
||||
x64_default_dir() {
|
||||
local d
|
||||
@@ -319,76 +317,6 @@ print("droiddeck-steam-x64: %d Linux title(s) on DroidDeck direct (%d on the new
|
||||
PY
|
||||
}
|
||||
|
||||
# Whether every program in the FEX tree at $1 finds its libraries (r4 did not without libxxhash).
|
||||
fex_loads() {
|
||||
local b out
|
||||
for b in FEX FEXServer unsquashfs; do
|
||||
out=$(/usr/lib/ld-linux-aarch64.so.1 --list "$1/usr/local/bin/$b" 2>&1) && ! grep -q "not found" <<<"$out" && continue
|
||||
echo "== FEX check: $b: $(grep -E "not found|error" <<<"$out" | tr -s '\t ' ' ' | tr '\n' ';')" >&2
|
||||
return 1
|
||||
done
|
||||
}
|
||||
|
||||
# Installs one FEX build only once its archive matches the sha256 and it loads. The files it replaces are kept
|
||||
# until the installed copy loads too, and put back otherwise; the tag is written last.
|
||||
fex_install() {
|
||||
local tag=$1 sha=$2 urls=$3 dst=/ tmp u f
|
||||
tmp=$(mktemp -d)
|
||||
for u in $urls; do
|
||||
curl -fsSL --retry 2 "$u" -o "$tmp/fex.tzst" && echo "$sha $tmp/fex.tzst" | sha256sum -c --quiet >/dev/null 2>&1 && break
|
||||
rm -f "$tmp/fex.tzst"
|
||||
done
|
||||
if [ ! -s "$tmp/fex.tzst" ]; then
|
||||
echo "== FEX $tag: no source gave the archive with sha256 ${sha:0:12}" >&2
|
||||
rm -rf "$tmp"
|
||||
return 1
|
||||
fi
|
||||
if ! { mkdir "$tmp/root" && zstd -dc "$tmp/fex.tzst" | tar -C "$tmp/root" -x && fex_loads "$tmp/root"; }; then
|
||||
rm -rf "$tmp"
|
||||
return 1
|
||||
fi
|
||||
(cd "$tmp/root" && find . ! -type d) > "$tmp/files"
|
||||
mkdir "$tmp/old"
|
||||
while IFS= read -r f; do
|
||||
f=${f#./}
|
||||
if [ -e "$dst$f" ] || [ -L "$dst$f" ]; then
|
||||
cp -a --parents "$dst$f" "$tmp/old" || { echo "== FEX $tag: could not keep $dst$f aside" >&2; rm -rf "$tmp"; return 1; }
|
||||
fi
|
||||
done < "$tmp/files"
|
||||
if tar -C "$tmp/root" -c . | tar -C "$dst" -x && fex_loads "$dst" &&
|
||||
mkdir -p "${dst}usr/local/share/fex-emu" && echo "$tag" > "${dst}usr/local/share/fex-emu/.droiddeck-tag"; then
|
||||
rm -rf "$tmp"
|
||||
return 0
|
||||
fi
|
||||
echo "== FEX $tag: the installed copy did not load or its tag was not written; putting the previous files back" >&2
|
||||
while IFS= read -r f; do
|
||||
f=${f#./}
|
||||
[ -e "$tmp/old/$dst$f" ] || [ -L "$tmp/old/$dst$f" ] || rm -f "$dst$f"
|
||||
done < "$tmp/files"
|
||||
tar -C "$tmp/old$dst" -c . | tar -C "$dst" -x || echo "== FEX $tag: could not put the previous files back" >&2
|
||||
rm -rf "$tmp"
|
||||
return 1
|
||||
}
|
||||
|
||||
# The build DroidDeck-Components' fex.json names (the app passes it as BL_FEX_*) comes first, then a working
|
||||
# installed one, then FEX_TAG above. Sets FEX_NOW and FEX_FROM.
|
||||
x64_fex() {
|
||||
local have ok=
|
||||
have=$(cat /usr/local/share/fex-emu/.droiddeck-tag 2>/dev/null || true)
|
||||
[ -x /usr/local/bin/FEX ] && fex_loads / && ok=1
|
||||
if [ -n "${BL_FEX_TAG:-}" ]; then
|
||||
if [ -n "$ok" ] && [ "$have" = "$BL_FEX_TAG" ]; then FEX_NOW=$have FEX_FROM=catalog; return 0; fi
|
||||
step "downloading FEX ($BL_FEX_TAG)"
|
||||
if fex_install "$BL_FEX_TAG" "${BL_FEX_SHA256:-}" "${BL_FEX_URLS:-}"; then FEX_NOW=$BL_FEX_TAG FEX_FROM=catalog; return 0; fi
|
||||
if [ -n "$ok" ]; then FEX_NOW=$have FEX_FROM="kept; $BL_FEX_TAG did not install"; return 0; fi
|
||||
fi
|
||||
if [ -n "$ok" ] && [ "$have" = "$FEX_TAG" ]; then FEX_NOW=$have FEX_FROM=built-in; return 0; fi
|
||||
step "downloading FEX ($FEX_TAG)"
|
||||
if fex_install "$FEX_TAG" "$FEX_SHA256" "$FEX_URL"; then FEX_NOW=$FEX_TAG FEX_FROM=built-in; return 0; fi
|
||||
if [ -n "$ok" ]; then FEX_NOW=$have FEX_FROM="kept; $FEX_TAG did not install"; return 0; fi
|
||||
return 1
|
||||
}
|
||||
|
||||
# A resumable download that reports every tenth of its size as a step.
|
||||
x64_fetch() {
|
||||
local url=$1 out=$2 label=$3 total pid rc=0 last=-1 pct
|
||||
@@ -406,7 +334,7 @@ x64_fetch() {
|
||||
}
|
||||
|
||||
x64_prepare() {
|
||||
x64_fex || { step "FEX could not be installed; see $LOG"; exit 1; }
|
||||
fex_ready || { step "FEX could not be installed; see $LOG"; exit 1; }
|
||||
step "FEX ready ($FEX_NOW, $FEX_FROM)"
|
||||
# The client's opt-in to its SteamRT3 build; without it, it re-executes through steam.sh, whose checks fail under proot.
|
||||
mkdir -p "$STEAM_X64" && : > "$STEAM_X64/.steam-enable-steamrt64-client"
|
||||
|
||||
Reference in new issue
Block a user