Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/upstream-sync-state.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"upstream_repo": "x86sim/x86sim",
"upstream_branch": "main",
"upstream_sha": "f2a18dd1a6ac3cbfdc12516f0d1b1332e30c2b13",
"upstream_sha": "b2f8208fe06d6d3c5c94c0f3711b19564990dcff",
"maintained_branch": "main",
"maintained_base_sha": "592dfa86fc1c9be5e85f6fb26e732dce3f5fd454",
"commits_merged": 6,
"maintained_base_sha": "75472c8fca5cb3e078f9d587e7750288ecb6914e",
"commits_merged": 2,
"latest_upstream_release": "v0.11.0",
"recent_upstream_releases": [
{
Expand Down Expand Up @@ -43,6 +43,6 @@
"url": "https://github.com/x86sim/x86sim/releases/tag/v0.9.0"
}
],
"synced_at_utc": "2026-12-05T18:54:31.291624+00:00",
"synced_at_utc": "2026-12-06T07:56:33.169858+00:00",
"status": "pending_review"
}
49 changes: 31 additions & 18 deletions build/release/AppRun
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,32 @@ CACHE=$(legacy "${X86SIM_CACHE:-}" "$CACHE")
[ -f "$DATA/x86sim.env" ] && grep -q X86CODE_ "$DATA/x86sim.env" && sed -i 's/X86CODE_/X86SIM_/g' "$DATA/x86sim.env"
APP=$DATA/app/$VER
mkdir -p "$DATA/app" "$DATA/runtimes" "$DATA/var" "$CACHE"
# launchers started together (one x86sim test per phone, #205) set up one at a time: the payload copy and the links
# below are not safe to run twice at once; the lock is let go before the command runs
if command -v flock > /dev/null 2>&1; then exec 9> "$DATA/.launch.lock"; flock 9; fi
# point link $2 at $1: left alone when it already does, else replaced in one rename (ln -sfn unlinks, then creates:
# a launcher in between failed with "Already exists")
relink() {
[ -L "$2" ] && [ "$(readlink "$2")" = "$1" ] && return 0
ln -sfn "$1" "$2.$$" && mv -Tf "$2.$$" "$2"
}
if [ ! -f "$APP/.complete" ] || [ -n "${X86SIM_REFRESH_PAYLOAD:-}" ]; then
rm -rf "$APP.tmp"
mkdir -p "$APP.tmp"
cp -a "$S/payload/." "$APP.tmp/"
cp -a "$S/bin" "$S/licenses" "$S/VERSION" "$S/DARLING_ID" "$S/install-helper.sh" "$APP.tmp/"
T=$APP.tmp.$$
rm -rf "$T"
mkdir -p "$T"
cp -a "$S/payload/." "$T/"
cp -a "$S/bin" "$S/licenses" "$S/VERSION" "$S/DARLING_ID" "$S/install-helper.sh" "$T/"
# x86sim inspect's frontend (share/inspect.rs finds it at <app>/webinspector)
[ ! -d "$S/webinspector" ] || cp -a "$S/webinspector" "$APP.tmp/"
touch "$APP.tmp/.complete"
[ ! -d "$S/webinspector" ] || cp -a "$S/webinspector" "$T/"
touch "$T/.complete"
rm -rf "$APP"
mv "$APP.tmp" "$APP"
mv "$T" "$APP"
# keep this version and the one before (by modification time)
ls -1dt "$DATA"/app/*/ 2>/dev/null | tail -n +3 | while read -r d; do rm -rf "$d"; done
fi
for d in cli host linux tools tests; do
[ -e "$APP/$d" ] || continue
if [ -L "$DATA/$d" ] || [ ! -e "$DATA/$d" ]; then ln -sfn "app/$VER/$d" "$DATA/$d"; fi
if [ -L "$DATA/$d" ] || [ ! -e "$DATA/$d" ]; then relink "app/$VER/$d" "$DATA/$d"; fi
done
# Darling: "system" = installed by the setup wizard into /opt/x86sim (bin/darling setuid root, one password prompt);
# "userns" = no root at all, through an unprivileged user namespace (darling-userns.sh); "nonroot" = no root and no
Expand All @@ -77,20 +87,22 @@ fi
case $mode in system|userns|nonroot) ;; *) echo "x86sim: X86SIM_DARLING_MODE=$mode: use system, userns or nonroot" >&2; exit 1 ;; esac
if [ "$mode" = userns ] || [ "$mode" = nonroot ]; then
if [ ! -f "$APP/darling/.x86sim-copied" ]; then
rm -rf "$APP/darling.tmp"
cp -a "$S/darling" "$APP/darling.tmp"
T=$APP/darling.tmp.$$
rm -rf "$T"
cp -a "$S/darling" "$T"
# bin/darling is setuid in the payload (for the system install); here it must not be: as root in a container
# whose AppImage was unpacked by another uid it ran as that uid, and Darling refused a launcher with privileges
# but not root ("started with privileges, but not as root", #13)
chmod -R u-s,g-s "$APP/darling.tmp"
touch "$APP/darling.tmp/.x86sim-copied"
mv "$APP/darling.tmp" "$APP/darling"
chmod -R u-s,g-s "$T"
touch "$T/.x86sim-copied"
mv "$T" "$APP/darling"
fi
U=$APP/darling-$mode
mkdir -p "$U/bin"
cp "$S/darling-$mode.sh" "$U/bin/darling"
ln -sfn ../../darling/bin/darlingserver "$U/bin/darlingserver"
ln -sfn ../darling/libexec "$U/libexec"
# a running phone's darling reads this script: a new copy goes in by rename, never by rewriting it in place
cp "$S/darling-$mode.sh" "$U/bin/darling.$$" && mv -f "$U/bin/darling.$$" "$U/bin/darling"
relink ../../darling/bin/darlingserver "$U/bin/darlingserver"
relink ../darling/libexec "$U/libexec"
echo "$DID" > "$U/.x86sim-complete"
: > "$U/.x86sim-$mode"
target=app/$VER/darling-$mode
Expand All @@ -99,14 +111,15 @@ else
fi
# relative (as every link here): Darling sees these paths under /Volumes/SystemRoot, where an absolute target would
# resolve against the container's own root
if [ -L "$DATA/darling-prefix" ] || [ ! -e "$DATA/darling-prefix" ]; then ln -sfn "$target" "$DATA/darling-prefix"; fi
if [ -L "$DATA/darling-prefix" ] || [ ! -e "$DATA/darling-prefix" ]; then relink "$target" "$DATA/darling-prefix"; fi
# the app menu entry (tools/launcher/core/src/desktop.rs) runs $DATA/x86sim.AppImage: follow this AppImage wherever it
# is now (moved, renamed, a newer version started from elsewhere), when the entry is x86Sim's
if [ -n "${APPIMAGE:-}" ] && [ -f "$APPIMAGE" ] && [ -L "$DATA/x86sim.AppImage" ] &&
grep -qx 'X-X86Sim-Managed=true' "${XDG_DATA_HOME:-$HOME/.local/share}/applications/x86sim.desktop" 2>/dev/null &&
[ "$(readlink "$DATA/x86sim.AppImage")" != "$APPIMAGE" ]; then
ln -sfn "$APPIMAGE" "$DATA/x86sim.AppImage.new" && mv -Tf "$DATA/x86sim.AppImage.new" "$DATA/x86sim.AppImage"
relink "$APPIMAGE" "$DATA/x86sim.AppImage"
fi
exec 9>&-
export X86SIM_DARLING_MODE=$mode
# NixOS keeps the Vulkan drivers in /run/opengl-driver/share/vulkan/icd.d, which the loader finds only through
# XDG_DATA_DIRS (#35): without it mtlvk drew on the CPU
Expand Down
Loading