aboutsummaryrefslogtreecommitdiff
path: root/dbx-run
diff options
context:
space:
mode:
Diffstat (limited to 'dbx-run')
-rwxr-xr-xdbx-run32
1 files changed, 32 insertions, 0 deletions
diff --git a/dbx-run b/dbx-run
new file mode 100755
index 0000000..b8a2e52
--- /dev/null
+++ b/dbx-run
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: 0BSD
+
+set -euo pipefail
+
+if [[ $# -lt 1 ]]; then
+ echo "ERROR: missing command to run" >&2
+ exit 1
+fi
+
+c="dbx"
+d="$HOME/Developer/dbxroot"
+
+w="$(realpath "$PWD")"
+if [[ "$w" != "$d"* ]]; then
+ w="$d"
+fi
+
+tty="tty"
+if [[ ! -t 0 ]]; then
+ tty="tty=false"
+fi
+
+podman start "$c" >/dev/null
+exec podman exec \
+ --detach-keys "" \
+ --interactive \
+ --"$tty" \
+ --user "$(id -u):$(id -g)" \
+ --workdir "$w" \
+ dbx \
+ "$@"