From ee3a88858bb3636b39b02166bf57e220cf9cb6d5 Mon Sep 17 00:00:00 2001 From: Nicholas Rodrigues Lordello Date: Mon, 23 Mar 2026 14:53:22 +0100 Subject: Cleanup and License License code for publishing under GPL, and cleanup a bit (in particular, add a `Makefile` for building the Go `dbx-proxy` executable). --- Makefile | 20 ++++++++++++++++++++ README.md | 2 +- dbx | 3 ++- dbx-create | 7 ++++--- dbx-enter | 4 ++-- dbx-init | 3 ++- dbx-link | 4 ++-- dbx-proxy.go | 2 +- dbx-run | 4 ++-- 9 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 Makefile 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 </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 -- cgit v1.2.3