summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2026-09-28 16:04:24 +0300
committertslil <tslil@posteo.de>2026-09-28 16:04:39 +0300
commit5e594e4f49ab020a2b2dfe60023467cb24a82683 (patch)
tree9652688289a6b11e51d55a4e56c2527bdf6a9699
parente9439c89187fc736da234d4584e2cbaf217d35f0 (diff)
sand: swap command and directory arguments to avoid footgunHEADmaster
-rwxr-xr-xsand12
1 files changed, 7 insertions, 5 deletions
diff --git a/sand b/sand
index 3f7ce14..f8ab8c1 100755
--- a/sand
+++ b/sand
@@ -1,13 +1,15 @@
#!/usr/bin/env sh
if [ -z "$1" ]; then
- echo "Must provide a project directory to mount"
+ echo "Must provide a programme to run"
exit 1
fi;
-cmd="bash"
+CMD="$1"
+
+PROJ_DIR="."
if [ -n "$2" ]; then
- cmd="$2";
+ PROJ_DIR="$2";
fi;
bwrap \
@@ -38,6 +40,6 @@ bwrap \
--setenv TERM foot \
--setenv KAGI_API_KEY $KAGI_API_KEY \
--setenv PATH /home/$(whoami)/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin \
- --bind "$1" /home/$(whoami)/project/ \
+ --bind "$PROJ_DIR" /home/$(whoami)/project/ \
--chdir /home/$(whoami)/project/ \
- $cmd
+ $CMD