inlets / inletsctl

Create inlets servers on the top cloud platforms
https://docs.inlets.dev/
MIT License
457 stars 63 forks source link

Use explicit path for SUCCESS_CMD #118

Closed rgee0 closed 2 years ago

rgee0 commented 2 years ago

Signed-off-by: Richard Gee richard@technologee.co.uk

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.

During testing it became obvious that he checksum test would also fail on machines where the expected binary wasn't present, so the checkHash() function has now been included and adapted (due to this project using archives)

Also taken the opportunity to simplify the area that extracts the binary from the downloaded archive.

How Has This Been Tested?

Primarily the existing issue would affect CentOs9 so tested on CENtOS9

Using the existing script - this also highlighted that the Checksum would fail on CentOS9

# curl -sLSf https://inletsctl.inlets.dev | sudo sh
x86_64
Downloading package https://github.com/inlets/inletsctl/releases/download/0.8.16/inletsctl.tgz as /tmp/inletsctl.tgz
Download Complete, extracting /tmp/inletsctl.tgz to /tmp/ ...
OK
SHA256 fetched from release: 1c0c6ac8e057a62a155d3983ae2680e899bdb87ce6ab277f8423ed3f00865b16
main: line 117: shasum: command not found
SHA mismatch! This means there must be a problem with the download

Using the script containing the proposed change:

# curl -sLSf https://raw.githubusercontent.com/rgee0/inletsctl/getDotSh/get.sh | sudo sh
x86_64
Downloading package https://github.com/inlets/inletsctl/releases/download/0.8.16/inletsctl.tgz as /tmp/inletsctl.tgz
Download complete, extracting inletsctl from /tmp/inletsctl.tgz...
Binary extracted

Running with sufficient permissions to attempt to move inletsctl to /usr/local/bin
New version of inletsctl installed to /usr/local/bin
 _       _      _            _   _ 
(_)_ __ | | ___| |_ ___  ___| |_| |
| | '_ \| |/ _ \ __/ __|/ __| __| |
| | | | | |  __/ |_\__ \ (__| |_| |
|_|_| |_|_|\___|\__|___/\___|\__|_|

Version: 0.8.16
Git Commit: 6e5fff84b28be18a3be9699fa368d0449674ea42
Build target: linux/amd64

How are existing users impacted? What migration steps/scripts do we need?

Users are provided with greater breadth of support / reliability. No migration steps required.

Checklist:

I have:

alexellis commented 2 years ago

Thank you Richard 💪