From bf90761c8f29b066b953e27c4a5443b471393452 Mon Sep 17 00:00:00 2001 From: sabonerune <102559104+sabonerune@users.noreply.github.com> Date: Wed, 24 Dec 2025 10:13:33 +0000 Subject: [PATCH] feat(appimage): If necessary, start with `--no-sandbox`. --- .changeset/seven-apples-walk.md | 5 +++++ .../appimage/templates/AppRun.sh | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 .changeset/seven-apples-walk.md diff --git a/.changeset/seven-apples-walk.md b/.changeset/seven-apples-walk.md new file mode 100644 index 0000000..bf2a3ea --- /dev/null +++ b/.changeset/seven-apples-walk.md @@ -0,0 +1,5 @@ +--- +"app-builder-bin": minor +--- + +feat(appimage): If necessary, start with `--no-sandbox`. diff --git a/pkg/package-format/appimage/templates/AppRun.sh b/pkg/package-format/appimage/templates/AppRun.sh index 64c294f..f7f7a0f 100755 --- a/pkg/package-format/appimage/templates/AppRun.sh +++ b/pkg/package-format/appimage/templates/AppRun.sh @@ -36,13 +36,25 @@ fi isEulaAccepted=1 +HAVE_NO_SANDBOX=0 +for arg in "${args[@]}" ; do + if [ "$arg" = --no-sandbox ] ; then + HAVE_NO_SANDBOX=1 + break + fi +done +NO_SANDBOX= +if [ $HAVE_NO_SANDBOX -eq 0 ] && ! unshare -Ur true 2>/dev/null ; then + NO_SANDBOX=--no-sandbox +fi + atexit() { if [ $isEulaAccepted == 1 ] ; then if [ $NUMBER_OF_ARGS -eq 0 ] ; then - exec "$BIN" + exec "$BIN" $NO_SANDBOX else - exec "$BIN" "${args[@]}" + exec "$BIN" $NO_SANDBOX "${args[@]}" fi fi } @@ -126,4 +138,4 @@ if [ -z "$APPIMAGE_SILENT_INSTALL" ] ; then esac fi fi -{{end}} \ No newline at end of file +{{end}}