diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2026-03-23 14:53:22 +0100 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2026-03-23 14:53:22 +0100 |
| commit | ee3a88858bb3636b39b02166bf57e220cf9cb6d5 (patch) | |
| tree | dd0bf62aa56bdcb0b52344c7b8ea1f62f15852f0 | |
| parent | 26f172dd393ec3408312e7bcd9cdf04a666c1f29 (diff) | |
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).
| -rw-r--r-- | Makefile | 20 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rwxr-xr-x | dbx | 3 | ||||
| -rwxr-xr-x | dbx-create | 7 | ||||
| -rwxr-xr-x | dbx-enter | 4 | ||||
| -rwxr-xr-x | dbx-init | 3 | ||||
| -rwxr-xr-x | dbx-link | 4 | ||||
| -rw-r--r-- | dbx-proxy.go | 2 | ||||
| -rwxr-xr-x | dbx-run | 4 |
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 @@ -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. @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 ( @@ -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 |
