diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-11-10 16:57:33 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-11-10 16:57:33 -0700 |
commit | 0d7d66c2ae926426ea06dccf01ec2687747368ac (patch) | |
tree | dc1aecaa9aaa44a32dcc8cc4f9ef98f0d7c670bf /scripts | |
parent | 09f0ea7c8d20e892d18fa9d194d0a4d3739cf777 (diff) | |
download | dotfiles-0d7d66c2ae926426ea06dccf01ec2687747368ac.tar.gz |
wofi_ssh, ssh-and-tmux-term for athenet LXCs
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/desktop/wofi_ssh_lxc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/desktop/wofi_ssh_lxc b/scripts/desktop/wofi_ssh_lxc new file mode 100755 index 00000000..08898d7e --- /dev/null +++ b/scripts/desktop/wofi_ssh_lxc @@ -0,0 +1,17 @@ +#!/bin/bash + +# for connecting to athenet LXCs which don't have ssh daemons + +container=$(wofi --dmenu -p "name of container") +test -n "$container" || exit 0 +if [[ $container != *.* ]]; then + container="$container.silentflame.com" +fi + +host=$(perl -wlne'/^Host\s+(\S+)/ and !/\*/ and print $1' $HOME/.ssh/config \ + | wofi --dmenu -p "container's host" "$@") + +if [ -n "$host" -a -n "$container" ]; then + ssh-and-tmux-term "$host" --container-name="${container}" \ + --container-cmd="lxc-unpriv-attach -n %s --keep-var TERM --clear-env -vHOME=/root" +fi |