diff options
| author | Nicholas Rodrigues Lordello <[email protected]> | 2026-05-15 09:06:50 +0200 |
|---|---|---|
| committer | Nicholas Rodrigues Lordello <[email protected]> | 2026-05-15 09:06:50 +0200 |
| commit | 795342c5e7793b66c44e8482ec7dcd94bf4f8885 (patch) | |
| tree | f04ce612b0a3a3e67b6e60627f979205cd2af6e7 | |
| parent | 5a07d783ba5ba3e0e10dfcda140761e865c5673f (diff) | |
Fix Image and DBX Commandsmacos
| -rw-r--r-- | Containerfile | 3 | ||||
| -rw-r--r-- | Makefile | 9 | ||||
| -rwxr-xr-x | dbx-create | 45 | ||||
| -rwxr-xr-x | dbx-enter | 2 | ||||
| -rwxr-xr-x | dbx-proxy | 2 | ||||
| -rwxr-xr-x | dbx-start | 6 | ||||
| -rw-r--r-- | ssh/config.in | 1 |
7 files changed, 25 insertions, 43 deletions
diff --git a/Containerfile b/Containerfile index b808aab..84ba12e 100644 --- a/Containerfile +++ b/Containerfile @@ -30,6 +30,7 @@ RUN rm /etc/apt/apt.conf.d/docker-* && \ wget \ zip \ && \ + apt-get clean && \ rm -dr /var/lib/apt/lists/* # Passwordless sudo @@ -55,7 +56,9 @@ COPY --chmod=600 --chown=1000:1000 ssh/id_ed25519.pub /home/${USER}/.ssh/authori COPY --chown=1000:1000 custom/ /home/${USER}/ RUN rm /home/${USER}/README.md RUN if [ -f /home/${USER}/extra-packages ]; then \ + apt-get update && \ apt-get install -y $(cat /home/${USER}/extra-packages | xargs) && \ + apt-get clean && \ rm -dr /var/lib/apt/lists/* /home/${USER}/extra-packages; \ fi RUN if [ -x /home/${USER}/post-install ]; then \ @@ -1,18 +1,19 @@ .PHONY: all -all: ssh/cofig .container; - @ echo "install with 'make install'" +all: .container ssh/config ; .PHONY: install install: all mkdir -p $(HOME)/.local/bin ln -s $(PWD)/dbx $(HOME)/.local/bin/dbx +.container: Containerfile dbx-init ssh/id_ed25519.pub + container build --build-arg USER=$(USER) --pull --tag dbx . + touch $@ + ssh/config: ssh/config.in ssh/id_ed25519.pub cat $< \ | sed -e 's|$$PWD|$(PWD)|' \ > $@ -.container: ssh/id_ed25519.pub - ssh/id_% ssh/id_%.pub: ssh-keygen -C "$$(id -un)@$$(hostname)" -f ssh/id_$* -N "" -t $* @@ -3,42 +3,15 @@ set -euo pipefail -R="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" C="dbx" -echo "TODO:" -echo "- create temporary SSH key" -echo "- generate SSH configuration for host and guest" -echo "- create base container image" -echo " - initialize user" -echo " - add authorized keys for SSH login" -echo " - install required packages (sshd and tini)" -echo " - install nice to have packages (see toolbox image)" -echo " - setup socket cleanup with sshd_config" -echo "- magic encantation to create container" +if ! container system status &>/dev/null; then + container system start +fi -#if ! id $DBX_USER &>/dev/null; then -# useradd \ -# --comment "$DBX_USER_COMMENT" \ -# --create-home \ -# --groups sudo \ -# --shell /usr/bin/bash \ -# --uid 1000 \ -# --user-group \ -# $DBX_USER -#fi -# if container list --all | grep $C >/dev/null; then -# echo "already created" -# exit -# fi -# podman create \ -# --hostname dbx \ -# --label manager=dbx \ -# --name "$c" \ -# --user root:root \ -# --userns keep-id \ -# --volume "$d:$d:z" \ -# --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 +if container list --all | grep $C >/dev/null; then + echo "already created" + exit +fi + +container create --name $C --publish 4222:22 $C @@ -6,5 +6,5 @@ set -euo pipefail R="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" C="dbx" -container start $C >/dev/null +"$R/dbx-start" exec ssh -F "$R/ssh/config" $C @@ -12,5 +12,5 @@ R="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" C="dbx" port="$1" -container start "$C" >/dev/null +"$R/dbx-start" exec ssh -F "$R/ssh/config" -L "localhost:$port:localhost:$port" -N $C @@ -5,4 +5,8 @@ set -euo pipefail C="dbx" -container start $C >/dev/null +if ! container system status &>/dev/null; then + container system start +fi + +container start $C diff --git a/ssh/config.in b/ssh/config.in index daf23b8..5184310 100644 --- a/ssh/config.in +++ b/ssh/config.in @@ -3,3 +3,4 @@ Host dbx Port 4222 IdentitiesOnly yes IdentityFile $PWD/ssh/id_ed25519 + NoHostAuthenticationForLocalhost yes |
