From: Jordan Justen <jljusten@debian.org>
Date: Wed, 9 Apr 2025 01:02:05 -0700
Subject: libstore/meson: Sandbox shell isn't required at build time unless
 embedded

A sandbox shell can be specified which is not present at build time.
This shell can be marked as a dependency for installing the package.

Signed-off-by: Jordan Justen <jljusten@debian.org>
---
 src/libstore/meson.build | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/libstore/meson.build b/src/libstore/meson.build
index a35dcb5..dc84f7d 100644
--- a/src/libstore/meson.build
+++ b/src/libstore/meson.build
@@ -143,6 +143,18 @@ sandbox_shell = find_program(
   get_option('sandbox-shell'),
   required : get_option('embedded-sandbox-shell')
 )
+if sandbox_shell.found()
+  use_sandbox_shell = true
+  sandbox_shell = sandbox_shell.full_path()
+elif get_option('sandbox-shell') != 'busybox'
+  # A non-default shell was specified. It may be present at runtime,
+  # even if not available at build time.
+  use_sandbox_shell = true
+  sandbox_shell = get_option('sandbox-shell')
+else
+  use_sandbox_shell = false
+  sandbox_shell = ''
+endif
 
 if get_option('embedded-sandbox-shell')
   # This one goes in config.h
@@ -403,9 +415,9 @@ if get_option('embedded-sandbox-shell')
   cpp_str_defines += {
     'SANDBOX_SHELL': '__embedded_sandbox_shell__'
   }
-elif sandbox_shell.found()
+elif use_sandbox_shell
   cpp_str_defines += {
-    'SANDBOX_SHELL': sandbox_shell.full_path()
+    'SANDBOX_SHELL': sandbox_shell
   }
 endif
 
