diff options
| author | Silvio Rhatto <rhatto@riseup.net> | 2024-11-22 11:44:20 -0300 | 
|---|---|---|
| committer | Silvio Rhatto <rhatto@riseup.net> | 2024-11-22 11:44:20 -0300 | 
| commit | c8c08dd40ada56fac2a65399959c2d10e51ce40c (patch) | |
| tree | c94323260c2f0f5e08e2ca7b1ee8b5733eeaa2e7 | |
| parent | 320ecb7fd56a84cba4165c53f1b29fd53840dd3f (diff) | |
| download | kvmx-c8c08dd40ada56fac2a65399959c2d10e51ce40c.tar.gz kvmx-c8c08dd40ada56fac2a65399959c2d10e51ce40c.tar.bz2  | |
Feat: release 0.4.0, improving sshdir command to be best-effort0.4.0
| -rw-r--r-- | ChangeLog.md | 23 | ||||
| -rwxr-xr-x | kvmx | 7 | 
2 files changed, 25 insertions, 5 deletions
diff --git a/ChangeLog.md b/ChangeLog.md index b99c8cf..1f2b69b 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,19 +1,36 @@  # ChangeLog -## 0.4.0 - Unreleased +## 0.4.0 - 2024-11-22  * Adds `kvmx sshdir` action, which SSH's to the guest and changes to a given    folder. If no arguments are given, it tries to change to the equivalent -  folder in the guest, so it can be a way to "cd" to the same directory but +  folder in the guest, so it can be a way to `cd` to the same directory but    inside the guest.    If the folder in the host is also mounted in the guest in a similar    mountpoint, it's a handy way to move to the same folder, but inside the    guest. -  For folders inside $HOME, user name conversion is automatically done since +  For folders inside $`HOME`, user name conversion is automatically done since    the user inside the guest might not match the user in the host. +  Note: this is done in a best-effort basis. It might not work depending +  on the remote shell in use. To increase the changes, it's suggested that +  the remote shell's startup scripts support the `STARTUP_FOLDER` as +  follows. + +  Example 1 (sh-compatible): + +    # Only change to the startup folder if it's set +    if [ ! -z "$STARTUP_FOLDER" ]; then +      cd $STARTUP_FOLDER +    fi + +  Example 2 (sh-compatible): + +    # Make sure we start at the startup folder, defaulting to home +    cd $STARTUP_FOLDER +  ## 0.3.0 - 2024-09-19  * Increase the maximum number of shared folders to avoid error in when KVMX @@ -19,7 +19,7 @@  #  # Basic parameters -VERSION="0.3.0" +VERSION="0.4.0"  BASENAME="`basename $0`"  DIRNAME="`dirname $0`"  ACTION="$1" @@ -1030,11 +1030,14 @@ function kvmx_sshdir {    # * https://stackoverflow.com/questions/626533/how-can-i-ssh-directly-to-a-particular-directory#626670    # * https://unix.stackexchange.com/questions/86941/how-to-ssh-into-a-specific-directory    # -  $ssh_env $SSH_COMMAND -t -p $SSH 127.0.0.1 "cd $DEST && exec \$SHELL --login" +  #$ssh_env $SSH_COMMAND -t -p $SSH 127.0.0.1 "cd $DEST && exec \$SHELL --login"    # Implementation using approach 2, with a special environment variable    # STARTUP_FOLDER, which needs to be supported by the shell startup scripts    #$ssh_env $SSH_COMMAND -t -p $SSH 127.0.0.1 "export STARTUP_FOLDER=$DEST && exec \$SHELL --login" + +  # Implementation using approach 3: best effort, trying both approaches 1 and 2 at the same time +  $ssh_env $SSH_COMMAND -t -p $SSH 127.0.0.1 "export STARTUP_FOLDER=$DEST && cd $DEST && exec \$SHELL --login"  }  # Enhanced SSH login into the guest  | 
