From cfd149cba151178a5214607f2f1eb4b15a68982a Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Sat, 19 Oct 2024 16:23:10 +0200 Subject: [PATCH] build: Fix moar --- TODO.md | 16 +++++++++------- container/devshell/test-ssh-agent | 2 +- container/git-server/test | 2 +- test | 10 +++++----- toolbox.sh | 2 +- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/TODO.md b/TODO.md index 7c6ce40..2d7a92b 100644 --- a/TODO.md +++ b/TODO.md @@ -6,20 +6,22 @@ Remember to use _Ctrl-P_ (for fzf) and `f` (for rg=ripgrep; and _Ctrl-H_ in VSC) - shellcheck pre-commit and GitHub action, fix all errors +- Replace the massive copy/paste in the Bash shell scripts with a library of Shell functions (at least, if not something better) + - https://sw.kovidgoyal.net/kitty/kittens/hints/ - [DNF v5](https://www.zdnet.com/google-amp/article/how-to-install-dnf5-on-fedora-39-for-faster-application-installation-and-management/)? Try in container! - fix SSH_AUTH_SOCK "bug" in dotfiles - - Remember how https://github.com/vorburger/vorburger-dotfiles-bin-etc/commit/36771f62ac2c31e40cbc9d72ca58adef00c263db + - Remember how https://github.com/vorburger/vorburger-dotfiles-bin-etc/commit/36771f62ac2c31e40cbc9d72ca58adef00c263db was reverted on 2023-01-07, see https://github.com/vorburger/vorburger-dotfiles-bin-etc/commit/6bafbde1afd456fca5d32761f09142584058bb97 - - Cannot "ssh localhsot" in GNOME Terminal instead of in Kitty + - Cannot "ssh localhsot" in GNOME Terminal instead of in Kitty because `SSH_AUTH_SOCKET` was set to `/run/user/1000/keyring/ssh` instead of `/home/vorburger/.ssh.agent` ... - - Retrace what set this where! - - Move `SSH_AUTH_SOCKET` magic from `bin/tmux-local`, `bin/tmux3` and `tmux-ssh` to... some place "earlier". - - This is also why VSC Remote localhost fails... does that work now? - - Do the VSC Beancount Extensions for LLnP work remotely now? Probably not, just like they don't from the laptop. Open issues. - - This might fix the git-server login? Not sure, could be unrelated. + - Retrace what set this where! + - Move `SSH_AUTH_SOCKET` magic from `bin/tmux-local`, `bin/tmux3` and `tmux-ssh` to... some place "earlier". + - This is also why VSC Remote localhost fails... does that work now? + - Do the VSC Beancount Extensions for LLnP work remotely now? Probably not, just like they don't from the laptop. Open issues. + - This might fix the git-server login? Not sure, could be unrelated. - Make `alias c` use `glow` or `mdcat` instead of `bat` IFF MD diff --git a/container/devshell/test-ssh-agent b/container/devshell/test-ssh-agent index e414252..b02e977 100755 --- a/container/devshell/test-ssh-agent +++ b/container/devshell/test-ssh-agent @@ -12,7 +12,7 @@ ssh-add -l docker rm --force test-"$1" || true docker run -d -p 2222 --name test-"$1" "$1" -PORT="$(docker port test-"$1" | sed 's/2222\/tcp -> 0.0.0.0://')" +PORT="$(docker port test-"$1" | head -n1 | sed 's/2222\/tcp -> 0.0.0.0://')" sleep 2 rm -f /tmp/test-$$-id_rsa* diff --git a/container/git-server/test b/container/git-server/test index a84f2ae..5b0f024 100755 --- a/container/git-server/test +++ b/container/git-server/test @@ -10,7 +10,7 @@ cp /tmp/test-$$-id_rsa.pub /tmp/test-$$-id_rsa.ssh/authorized_keys docker rm --force test-git-server || true docker run -d -p 2222 -v /tmp/test-$$-id_rsa.ssh/:/home/git/.ssh/:ro,Z --name test-git-server git-server -PORT="$(docker port test-git-server | sed 's/2222\/tcp -> 0.0.0.0://')" +PORT="$(docker port test-git-server | head -n1 | sed 's/2222\/tcp -> 0.0.0.0://')" sleep 2 ssh -i /tmp/test-$$-id_rsa -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p "$PORT" git@127.0.0.1 && exit 1 diff --git a/test b/test index 70e6ad0..782ff37 100755 --- a/test +++ b/test @@ -9,19 +9,19 @@ cd "$(dirname "$0")" # but use the 'vorburger' user created in the ./Dockerfile, instead of creating a 'tester' on the fly.. # (TODO avoid copy/paste from ../container/devshell/test-ssh-agent, which itself copy/pasted from ../sshd/test) -docker rm --force --time=1 test-vorburger-again || true +docker rm --force test-vorburger-again || true docker run -d -p 2222 --name test-vorburger-again vorburger -PORT="$(docker port test-vorburger-again | sed 's/2222\/tcp -> 0.0.0.0://')" +PORT="$(docker port test-vorburger-again | head -n1 | sed 's/2222\/tcp -> 0.0.0.0://')" rm -f /tmp/test-$$-id_rsa* ssh-keygen -f /tmp/test-$$-id_rsa -P "" -C test-vorburger-again docker cp /tmp/test-$$-id_rsa test-vorburger-again:/home/vorburger/.ssh/test.pubkey docker exec test-vorburger-again cat /home/vorburger/.ssh/test.pubkey >> /home/vorburger/.ssh/authorized_keys -ssh -A -i /tmp/test-$$-id_rsa -o "StrictHostKeyChecking=no" -p $PORT vorburger@localhost ssh-add -l +ssh -A -i /tmp/test-$$-id_rsa -o "StrictHostKeyChecking=no" -p "$PORT" vorburger@localhost ssh-add -l # This tests if the local SSH YubiKey works (which does not work on CI) -ssh -A -o "StrictHostKeyChecking=no" -p $PORT vorburger@localhost ssh-add -l +ssh -A -o "StrictHostKeyChecking=no" -p "$PORT" vorburger@localhost ssh-add -l -docker rm --force --time=1 test-vorburger-again +docker rm --force test-vorburger-again echo Test ~vorburger successful. diff --git a/toolbox.sh b/toolbox.sh index fb4e44e..85e5e35 100755 --- a/toolbox.sh +++ b/toolbox.sh @@ -2,7 +2,7 @@ set -euxo pipefail docker build -t vorburger-toolbox -f Dockerfile-toolbox . -docker rm --force --time=1 vorburger-toolbox || true +docker rm --force vorburger-toolbox || true toolbox create -i vorburger-toolbox toolbox enter vorburger-toolbox