Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle problems caused by the tmux function in install.sh masking the tmux binary itself #765

Merged
merged 2 commits into from Jan 29, 2024

Conversation

gkc
Copy link
Contributor

@gkc gkc commented Jan 29, 2024

Fixes #761

- What I did

  • fix: install.sh: Handle problems caused by the tmux function masking the tmux binary itself
  • fix: install.sh:
    • When copying binaries during installation, rename existing binaries as they may be in use (which is a problem in, for example, Windows)
    • Exit the install script if either the rename of existing or the copying of new binaries fails
  • fix: install.sh: for installs using tmux, separate the handling of crontab installation from the handling of tmux process killing
  • feat: install.sh: If the installation killed a process running as a tmux session, then also restart it

- How I did it

  • See file diff
  • Note that I didn't rename the tmux function but instead used command tmux whenever needing to use the tmux command itself
  • While mulling over all of this, I came to the opinion that just killing an existing tmux session might be unhelpful and that it would be more helpful to restart the tmux session if there was one there to kill. However I preserve the current behaviour of not starting the tmux session if it is not already running.

…g the tmux binary itself

fix: When copying binaries during installation, ensure existing binaries are overwritten
fix: for installs using tmux, separate the handling of crontab installation from the handling of tmux process killing
feat: If we killed a process running as a tmux session, then also restart it
…te, as there will be problems with overwriting executables which are in use on, for example, Windows
@XavierChanth XavierChanth merged commit c035287 into trunk Jan 29, 2024
6 checks passed
@cconstab
Copy link
Member

So I tried this in today and it failed to copy over sshnpd the first time it would seem. The second time worked fine see log below..

cconstab@orac:~/sshnp$ vi install.sh
cconstab@orac:~/sshnp$ ./install.sh tmux sshnpd
cconstab@orac:~/sshnp$
cconstab@orac:~/sshnp$
cconstab@orac:~/sshnp$
cconstab@orac:~/sshnp$ ~/.local/bin/sshnpd
-bash: /home/cconstab/.local/bin/sshnpd: No such file or directory
cconstab@orac:~/sshnp$ ./install.sh tmux sshnpd
=> Installed sshnpd to /home/cconstab/.local/bin
cconstab@orac:~/sshnp$ ~/.local/bin/sshnpd
Version : 5.0.1 (core: 6.0.1)
-k, --key-file,--keyFile              Sending atSign's keyFile if not in ~/.atsign/keys/
-a, --atsign (mandatory)              atSign of this device
-m, --manager (mandatory)             Managers atSign, that this device will accept triggers from
-d, --device                          Send a trigger to this device, allows multiple devices share an atSign
                                      (defaults to "default")
-s, --[no-]sshpublickey               When set, will update authorized_keys to include public key sent by manager
-u, --[no-]un-hide,--[no-]username    When set, makes various information visible to the manager atSign - e.g. username, version, etc
-v, --[no-]verbose                    More logging
    --ssh-client                      What to use for outbound ssh connections.
                                      [openssh (default), dart]
    --root-domain                     atDirectory domain
                                      (defaults to "root.atsign.org")
    --local-sshd-port                 port on which sshd is listening locally on localhost
                                      (defaults to "22")
    --ephemeral-permissions           The permissions which will be added to the authorized_keys file for the ephemeral public keys which are generated when a client is
                                      connecting via forward ssh e.g. PermitOpen="host-1:3389",PermitOpen="localhost:80"
                                      (defaults to "")
    --ssh-algorithm                   Use RSA 4096 keys rather than the default ED25519 keys
                                      [ssh-ed25519 (default), ssh-rsa]
    --storage-path                    Directory for local storage. Defaults to $HOME/.sshnp/${atSign}/storage

Invalid argument(s): Option atsign is mandatory.
cconstab@orac:~/sshnp$

@gkc gkc deleted the fix/761 branch February 7, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v5.0.1 install.sh does not work to upgrade sshnp/sshnpd
3 participants