mirror of
https://github.com/razzant/ouroboros.git
synced 2026-10-19 10:04:16 +00:00
Some checks failed
CI / quick-test (push) Has been cancelled
CI / full-test (macos-latest) (push) Has been cancelled
CI / full-test (ubuntu-latest) (push) Has been cancelled
CI / full-test (windows-latest) (push) Has been cancelled
CI / integration-test (push) Has been cancelled
CI / skill-smoke (macos-latest) (push) Has been cancelled
CI / skill-smoke (ubuntu-latest) (push) Has been cancelled
CI / skill-smoke (windows-latest) (push) Has been cancelled
CI / marker-guards (push) Has been cancelled
CI / ui-smoke (push) Has been cancelled
CI / docker-ui-smoke (push) Has been cancelled
CI / docker-portable-test (push) Has been cancelled
Scorecard analysis workflow / Scorecard analysis (push) Has been cancelled
Sync Joi Lab Fork Mirror / sync (push) Has been cancelled
Claudexor platform gate (API keys — subscription auth NOT covered) / fixture · macos-latest · exact managed runtime, fake harness, no model (push) Has been cancelled
Claudexor platform gate (API keys — subscription auth NOT covered) / fixture · ubuntu-latest · exact managed runtime, fake harness, no model (push) Has been cancelled
Claudexor platform gate (API keys — subscription auth NOT covered) / fixture · windows-latest · exact managed runtime, fake harness, no model (push) Has been cancelled
Claudexor platform gate (API keys — subscription auth NOT covered) / live · macos-latest · claude · API key only, subscription NOT covered (push) Has been cancelled
Claudexor platform gate (API keys — subscription auth NOT covered) / live · ubuntu-latest · claude · API key only, subscription NOT covered (push) Has been cancelled
Claudexor platform gate (API keys — subscription auth NOT covered) / live · windows-latest · claude · API key only, subscription NOT covered (push) Has been cancelled
Claudexor platform gate (API keys — subscription auth NOT covered) / live · macos-latest · codex · API key only, subscription NOT covered (push) Has been cancelled
CI / release-preflight (push) Has been cancelled
CI / build (dmg, macos-latest, macos-arm64, syft_1.50.0_darwin_arm64.tar.gz, syft, e32fdb9d47823fa633748a1efca2528fd77c37469ea93c9e40ab835da44e4cce) (push) Has been cancelled
CI / build (tar.gz, ubuntu-latest, linux-x86_64, syft_1.50.0_linux_amd64.tar.gz, syft, bf7b29ff57f06da30918266a0e1c2885a8f99784798d1bdb1628886aa015d788) (push) Has been cancelled
CI / vendor-package-smoke (push) Has been cancelled
CI / release (push) Has been cancelled
CI / build (zip, windows-latest, windows-x64, syft_1.50.0_windows_amd64.zip, syft.exe, 815ee6973ec5dff6a671d7f41b0e78835a8c45b91d5a39f4743ea1cee833d3be) (push) Has been cancelled
Own nested AppImage extraction cleanup in the marker-gated AppRun custodian, preserve path-resolution failure semantics across supported Python versions, and advance all synchronized release carriers for the fix-forward release after v6.97.1. Co-authored-by: Ouroboros <311266734+ouroboros-agent@users.noreply.github.com>
102 lines
3.4 KiB
Bash
Executable file
102 lines
3.4 KiB
Bash
Executable file
#!/bin/sh
|
|
set -eu
|
|
|
|
APPDIR=${APPDIR:-$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)}
|
|
PAYLOAD="$APPDIR/usr/lib/ouroboros"
|
|
APPIMAGE_CUSTODY_BASE=
|
|
APPIMAGE_CUSTODY_APPDIR=
|
|
|
|
# A nested extract-and-run relaunch receives a private TMPDIR so it cannot share
|
|
# ownership of the outer CLI runtime's content-addressed extraction. Restore the
|
|
# caller's TMPDIR before the actual product starts. AppRun keeps custody of the
|
|
# private extraction until that product exits because the pinned musl type-2
|
|
# runtime cannot reliably remove it itself.
|
|
if [ "${OUROBOROS_APPIMAGE_RESTORE_TMPDIR:-}" = "1" ]; then
|
|
APPIMAGE_CUSTODY_BASE=${TMPDIR-}
|
|
APPIMAGE_CUSTODY_APPDIR=${APPDIR-}
|
|
if [ "${OUROBOROS_APPIMAGE_ORIGINAL_TMPDIR_SET:-0}" = "1" ]; then
|
|
TMPDIR=${OUROBOROS_APPIMAGE_ORIGINAL_TMPDIR-}
|
|
export TMPDIR
|
|
else
|
|
unset TMPDIR
|
|
fi
|
|
unset OUROBOROS_APPIMAGE_RESTORE_TMPDIR
|
|
unset OUROBOROS_APPIMAGE_ORIGINAL_TMPDIR_SET
|
|
unset OUROBOROS_APPIMAGE_ORIGINAL_TMPDIR
|
|
fi
|
|
|
|
# The mounted AppImage is immutable. PyInstaller and the launcher already route
|
|
# managed state, settings, logs, repositories, and bytecode to the user's data
|
|
# and cache roots; expose the same explicit bundle root to child processes.
|
|
export OUROBOROS_BUNDLE_DIR="$PAYLOAD/_internal"
|
|
|
|
if [ "${1:-}" = "--version" ]; then
|
|
VERSION_FILE="$OUROBOROS_BUNDLE_DIR/VERSION"
|
|
if [ ! -s "$VERSION_FILE" ]; then
|
|
echo "Ouroboros version metadata is missing" >&2
|
|
exit 1
|
|
fi
|
|
VERSION=
|
|
IFS= read -r VERSION < "$VERSION_FILE" || true
|
|
printf 'Ouroboros %s\n' "$VERSION"
|
|
exit 0
|
|
fi
|
|
|
|
if [ "${1:-}" = "--cli" ]; then
|
|
shift
|
|
exec "$PAYLOAD/bin/ouroboros" "$@"
|
|
fi
|
|
|
|
if [ -z "$APPIMAGE_CUSTODY_BASE" ]; then
|
|
exec "$PAYLOAD/Ouroboros" "$@"
|
|
fi
|
|
|
|
if [ -z "$APPIMAGE_CUSTODY_APPDIR" ]; then
|
|
echo "AppImage cleanup custody is missing its private runtime paths" >&2
|
|
exit 1
|
|
fi
|
|
APPIMAGE_CUSTODY_BASE=$(CDPATH= cd -- "$APPIMAGE_CUSTODY_BASE" && pwd -P) || {
|
|
echo "AppImage cleanup custody cannot resolve its private runtime root" >&2
|
|
exit 1
|
|
}
|
|
APPIMAGE_CUSTODY_APPDIR=$(CDPATH= cd -- "$APPIMAGE_CUSTODY_APPDIR" && pwd -P) || {
|
|
echo "AppImage cleanup custody cannot resolve its extracted payload" >&2
|
|
exit 1
|
|
}
|
|
case "${APPIMAGE_CUSTODY_BASE##*/}" in
|
|
ouroboros-appimage-runtime-?*) ;;
|
|
*)
|
|
echo "AppImage cleanup custody refused an unexpected private runtime root" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
if [ "$(dirname -- "$APPIMAGE_CUSTODY_APPDIR")" != "$APPIMAGE_CUSTODY_BASE" ]; then
|
|
echo "AppImage cleanup custody refused a payload outside its private runtime root" >&2
|
|
exit 1
|
|
fi
|
|
case "${APPIMAGE_CUSTODY_APPDIR##*/}" in
|
|
appimage_extracted_?*) ;;
|
|
*)
|
|
echo "AppImage cleanup custody refused an unexpected extracted payload" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
PAYLOAD_STATUS=0
|
|
"$PAYLOAD/Ouroboros" "$@" || PAYLOAD_STATUS=$?
|
|
CLEANUP_STATUS=0
|
|
rm -rf -- "$APPIMAGE_CUSTODY_APPDIR" || CLEANUP_STATUS=$?
|
|
if [ -e "$APPIMAGE_CUSTODY_APPDIR" ]; then
|
|
echo "AppImage cleanup custody left its extracted payload behind: $APPIMAGE_CUSTODY_APPDIR" >&2
|
|
CLEANUP_STATUS=1
|
|
fi
|
|
rmdir -- "$APPIMAGE_CUSTODY_BASE" || CLEANUP_STATUS=$?
|
|
if [ -e "$APPIMAGE_CUSTODY_BASE" ]; then
|
|
echo "AppImage cleanup custody left its private runtime root behind: $APPIMAGE_CUSTODY_BASE" >&2
|
|
CLEANUP_STATUS=1
|
|
fi
|
|
if [ "$PAYLOAD_STATUS" -eq 0 ] && [ "$CLEANUP_STATUS" -ne 0 ]; then
|
|
PAYLOAD_STATUS=$CLEANUP_STATUS
|
|
fi
|
|
|
|
exit "$PAYLOAD_STATUS"
|