diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-05-17 10:48:32 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-05-17 10:48:32 -0300 |
commit | 3cce6a2ec3ba86f8cd2e760dfae29769daf736fe (patch) | |
tree | 1d631de467008b782d09f9077994f95990e25688 | |
parent | 1d34d2f97c3924f30eb222472473a73abeb0a6da (diff) | |
download | kvmx-3cce6a2ec3ba86f8cd2e760dfae29769daf736fe.tar.gz kvmx-3cce6a2ec3ba86f8cd2e760dfae29769daf736fe.tar.bz2 |
Feat: adds login command0.1.0
-rwxr-xr-x | kvmx | 15 | ||||
-rw-r--r-- | kvmxfile | 6 |
2 files changed, 21 insertions, 0 deletions
@@ -881,6 +881,21 @@ function kvmx_ssh { $ssh_env $SSH_COMMAND -p $SSH 127.0.0.1 $* } +# Enhanced SSH login into the guest +function kvmx_login { + # This allows the usage of a custom login command + # + # It's not implemented directly in kvmx_ssh because it conflicts with use + # cases where SSH commands are read from stdin and not from positional + # arguments, like `echo something | kvmx_ssh`. + if [ -z "$1" ] && [ ! -z "$ssh_login_command" ]; then + # This needs the -t option to request a pseudo-terminal + kvmx_ssh -t $ssh_login_command + else + kvmx_ssh $* + fi +} + # Get guest SSH key fingerprints function kvmx_ssh_finger { if ls $DATADIR/ssh/*.pub.* &> /dev/null; then @@ -86,6 +86,12 @@ shared_folder_mountpoint="/home/$user/code/$VM" #startup_rsync_to_guest="data:data:/var/data,code:$HOME/code:/home/user/code" #poweroff_rsync_from_guest="data:/var/data:data,code:/home/user/code:$HOME/code" +# SSH login command when using `kvmx login` +# Login command when SSHing to the guest when no command is specified. +# Yout might need to invoke a login shell so your environment is populated etc. +#ssh_login_comman="tmux" +#ssh_login_command="bash --login -c 'shell local myprofile'" + # Graphics # See https://wiki.archlinux.org/index.php/QEMU#Graphics #graphics="-vga std -nographic -vnc :$GUEST_DISPLAY" |