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

Use explicit path for SUCCESS_CMD #379

Merged
merged 1 commit into from
May 11, 2022
Merged

Conversation

rgee0
Copy link
Contributor

@rgee0 rgee0 commented May 7, 2022

Signed-off-by: Richard Gee [email protected]

Description

This propagates a change that was initially made in arkade
(alexellis/arkade#685) after it was found
that sudo on CentOS9 was not able to find the new binary in the path
it uses by default. This led to a poor UX as the binary had been
installed but an error in running SUCCESS_CMD gave the impression
that the installation had failed. This change adds an explicit
path to SUCCESS_CMD so that it can be found when running through sudo
with a 'secure_path' set.

Also addressed is a future bug where ALIAS_NAME is set. $BINLOCATION was
only used once in the ln command which would lead to a future failure
where ALIAS_NAME is set and the BINLOCATION was not /usr/local/bin.

Motivation and Context

How Has This Been Tested?

Since the original issue affected CentOS9 this was tested on CentOS9.

Using current script, noting main: line 172: k3sup: command not found:

# curl -sLS https://get.k3sup.dev | sudo sh
x86_64
Downloading package https://github.com/alexellis/k3sup/releases/download/0.11.3/k3sup as /tmp/k3sup
Download complete.

Running with sufficient permissions to attempt to move k3sup to /usr/local/bin
New version of k3sup installed to /usr/local/bin
main: line 172: k3sup: command not found

================================================================
  Thanks for choosing k3sup.
  Support the project through GitHub Sponsors

  https://github.com/sponsors/alexellis
================================================================

Using proposed change in the branch on my fork:

# curl -sLS https://raw.githubusercontent.com/rgee0/k3sup/getDotSh/get.sh | sudo sh
x86_64
Downloading package https://github.com/alexellis/k3sup/releases/download/0.11.3/k3sup as /tmp/k3sup
Download complete.

Running with sufficient permissions to attempt to move k3sup to /usr/local/bin
New version of k3sup installed to /usr/local/bin
 _    _____                 
| | _|___ / ___ _   _ _ __  
| |/ / |_ \/ __| | | | '_ \ 
|   < ___) \__ \ |_| | |_) |
|_|\_\____/|___/\__,_| .__/ 
                     |_|    
Version: 0.11.3
Git Commit: e2bb18116d3686bf53cf40fe0998af7b6c9cf8a6

Give your support to k3sup via GitHub Sponsors:

https://github.com/sponsors/alexellis

================================================================
  Thanks for choosing k3sup.
  Support the project through GitHub Sponsors

  https://github.com/sponsors/alexellis
================================================================

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.

This propagates a change that was initially made in arkade
(alexellis/arkade#685) after it was found
that sudo on CentOS9 was not able to find the new binary in the path
it uses by default.  This led to a poor UX as the binary had been
installed but an error in running SUCCESS_CMD gave the impression
that the installation had failed.  This change adds an explicit
path to SUCCESS_CMD so that it can be found when running through sudo
with a 'secure_path' set.

Also addressed is a future bug where ALIAS_NAME is set.  $BINLOCATION was
only used once in the `ln` command which would lead to a future failure
where ALIAS_NAME is set and the BINLOCATION was not /usr/local/bin.

Signed-off-by: Richard Gee <[email protected]>
Copy link
Owner

@alexellis alexellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@alexellis alexellis merged commit dbcd86d into alexellis:master May 11, 2022
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.

2 participants