tofuutils / tenv

OpenTofu / Terraform / Terragrunt and Atmos version manager
https://tofuutils.github.io/tenv/
Apache License 2.0
712 stars 38 forks source link

Linux manual installation guide is largely incomplete #263

Open notorand-it opened 3 weeks ago

notorand-it commented 3 weeks ago

Describe the bug Manual installation guide is largely incomplete.

Expected details (example) If you can escalate to root privileges (with su or sudo or even logging in as root), you can make a system-wide installation of the tenvtool. Untar the package directly to /usr/bin or any other directory whose name is listed in the $PATH directory. As an option, you can untar it into any other directory (e.g. /usr/local/tenv) and then add it to the system-wide $PATH or even create symlinks from that directory to one already listed in $PATH. If you cannot escalate to root privileges, you need to untar the package into a directory inde your own $HOME (e.g. ~/bin), add that directory to your local $PATH (e.g. by using your .profile or .login file).

Any subsequent call to tenv will refer to the calling user $HOME directory, thus installing, running and listing whatever binaries are present in the local directory (~/.tenv by default).

Additional context Clear documentation is key to success IMHO.

kvendingoldo commented 3 weeks ago

Agree, thank you for reporting. It's a good point for us

notorand-it commented 3 weeks ago

Glad to be of any help.

notorand-it commented 6 days ago

I have the following suggestions to be merged in the README.md (is that really a markdown file?)

  1. Getting started/Prerequisites/Linux: local, static

    BINDIR=${HOME}/bin
    mkdir -p ${BINDIR}
    wget -q -O - "https://api.github.com/repos/sigstore/cosign/releases/latest" | \
    jq -r '.assets[] | select(.name | match("cosign-linux-amd64$") ) | .browser_download_url' | \
    wget -q -i - -O ${BINDIR}/cosign && chmod 700 ${BINDIR}/cosign
  2. Getting started/Installation/Manual installation

    BINDIR=${HOME}/bin
    mkdir -p ${BINDIR} &> /dev/null || true
    wget -q -O - "https://api.github.com/repos/tofuutils/tenv/releases/latest" | \
    jq -r '.assets[] | select(.name | match("Linux_x86_64.tar.gz$") ) | .browser_download_url' | \
    wget -q -i - -O - | tar xfz - -C ${BINDIR}

In case $BINDIR is a system dir (like /usr/bin), you need to prepend the tar command with either sudo or use any other privilege escalation tool.

I am deviating from your previous shell snippets because:

  1. quite often you can find wget but not curl.
  2. A single pipeline is better than a command concatenation (;)
  3. My solution for manual installation can be easily automated.
kvendingoldo commented 6 days ago

I will do the PR.