aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile20
-rw-r--r--README.md2
-rwxr-xr-xdbx3
-rwxr-xr-xdbx-create7
-rwxr-xr-xdbx-enter4
-rwxr-xr-xdbx-init3
-rwxr-xr-xdbx-link4
-rw-r--r--dbx-proxy.go2
-rwxr-xr-xdbx-run4
9 files changed, 36 insertions, 13 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..52d8950
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,20 @@
+GO := docker run -it --rm --security-opt label=disable -v $(PWD):/dbx -w /dbx docker.io/library/golang go
+
+.PHONY: all
+all: dbx-proxy ;
+
+.PHONY: install
+install: all
+ mkdir -p $(HOME)/.local/bin
+ ln -s $(PWD)/dbx $(HOME)/.local/bin/dbx
+
+dbx-proxy: dbx-proxy.go
+ $(GO) build -o $@ $<
+
+.PHONY: fmt
+fmt:
+ $(GO) fmt dbx-proxy.go
+
+.PHONY: clean
+clean:
+ rm -f dbx-proxy
diff --git a/README.md b/README.md
index 89efa6f..013037b 100644
--- a/README.md
+++ b/README.md
@@ -2,4 +2,4 @@
`dbx` is a set of scripts for managing a local containerized development environment. It works by creating a long-lived container named `dbx` with only access to a development root directory, where you can install various developer tools and dependencies without losing sleep at night.
-At its heart, it is extremely similar to Toolbx and Distrobox, but with as reduced permissions as possible for improved security. For example, unlike the aforementioned tools, `dbx` keeps SELinux enforcement; meaning that the `dbx` user cannot access other files if it manages to escape the namespace. In general, it does not try to create a convenient container that is seamlessly integrated with the host, but rather a restricted sandbox where you can install development tools.
+At its core, it is extremely similar to Toolbx and Distrobox, but with as reduced permissions as possible for improved security. For example, unlike the aforementioned tools, `dbx` keeps SELinux enforcement; meaning that the `dbx` user cannot access other files if it manages to escape the namespace. In general, it does not try to create a convenient container that is seamlessly integrated with the host, but rather a restricted sandbox where you can install development CLI tools, and reduce `npm install` risk.
diff --git a/dbx b/dbx
index 5c2bd1f..7d65003 100755
--- a/dbx
+++ b/dbx
@@ -1,8 +1,9 @@
#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-3.0-only
set -euo pipefail
-r="$HOME/.dbx"
+r="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
usage() {
cat <<EOF
diff --git a/dbx-create b/dbx-create
index a87a77b..fda7bf8 100755
--- a/dbx-create
+++ b/dbx-create
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
-# SPDX-License-Identifier: 0BSD
+# SPDX-License-Identifier: GPL-3.0-only
set -euo pipefail
-r="$HOME/.dbx"
+r="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
c="dbx"
-d="$HOME/Developer/dbxroot"
+d="$HOME/Developer"
if podman container exists "$c"; then
echo "already created"
@@ -22,3 +22,4 @@ podman create \
--volume "$r/dbx-init:/usr/local/bin/dbx-init:ro,z" \
registry.fedoraproject.org/fedora-toolbox:43 \
dbx-init "$(id -u)" "$(id -g)"
+podman start "$c" >/dev/null
diff --git a/dbx-enter b/dbx-enter
index 9095c9b..7852fa9 100755
--- a/dbx-enter
+++ b/dbx-enter
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
-# SPDX-License-Identifier: 0BSD
+# SPDX-License-Identifier: GPL-3.0-only
set -euo pipefail
c="dbx"
-d="$HOME/Developer/dbxroot"
+d="$HOME/Developer"
workdir="$(realpath "$PWD")"
if [[ "$workdir" != "$d"* ]]; then
diff --git a/dbx-init b/dbx-init
index 8ac2d90..3f2e8d6 100755
--- a/dbx-init
+++ b/dbx-init
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# SPDX-License-Identifier: 0BSD
+# SPDX-License-Identifier: GPL-3.0-only
set -euo pipefail
@@ -31,5 +31,6 @@ if [[ ! -d "$h" ]]; then
chown --recursive "$u:$g" "$h"
fi
+echo "=== READY TO ROLL! ==="
touch /run/.dbxenv
exec tini sleep infinity
diff --git a/dbx-link b/dbx-link
index 297ba02..cab4ecb 100755
--- a/dbx-link
+++ b/dbx-link
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# SPDX-License-Identifier: 0BSD
+# SPDX-License-Identifier: GPL-3.0-only
set -euo pipefail
@@ -8,7 +8,7 @@ if [[ $# -ne 1 ]]; then
exit 1
fi
-r="$HOME/.dbx"
+r="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
c="dbx"
p="$HOME/.local/share/dbx/bin"
diff --git a/dbx-proxy.go b/dbx-proxy.go
index 6e5048a..84688af 100644
--- a/dbx-proxy.go
+++ b/dbx-proxy.go
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: 0BSD
+// SPDX-License-Identifier: GPL-3.0-only
package main
import (
diff --git a/dbx-run b/dbx-run
index 2e3535d..1afec9c 100755
--- a/dbx-run
+++ b/dbx-run
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# SPDX-License-Identifier: 0BSD
+# SPDX-License-Identifier: GPL-3.0-only
set -euo pipefail
@@ -9,7 +9,7 @@ if [[ $# -lt 1 ]]; then
fi
c="dbx"
-d="$HOME/Developer/dbxroot"
+d="$HOME/Developer"
workdir="$(realpath "$PWD")"
if [[ "$workdir" != "$d"* ]]; then