asdf-community / asdf-hashicorp

HashiCorp plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
239 stars 54 forks source link

`nomad-pack` is unsupported #50

Closed spencergilbert closed 2 years ago

spencergilbert commented 2 years ago

While not necessarily suggesting it should be supported, I wanted to note that there are issues installing nomad-pack with this plugin.

You should run into the following error:

.asdf/plugins/nomad-pack/bin/install: line 120: ASDF_HASHICORP_OVERWRITE_ARCH_NOMAD-PACK: invalid variable name

I made the following hack locally to resolve the issue

get_arch() {
  local -r machine="$(uname -m)"
  # local -r upper_toolname=$(echo "${toolname}" | tr '[:lower:]' '[:upper:]')
  # local -r tool_specific_arch_override="ASDF_HASHICORP_OVERWRITE_ARCH_${upper_toolname}"

  # OVERWRITE_ARCH=${!tool_specific_arch_override:-${ASDF_HASHICORP_OVERWRITE_ARCH:-"false"}}
  OVERWRITE_ARCH=${ASDF_HASHICORP_OVERWRITE_ARCH:-"false"}

  if [[ $OVERWRITE_ARCH != "false" ]]; then
    echo "$OVERWRITE_ARCH"
  elif [[ $machine == "arm64" ]] || [[ $machine == "aarch64" ]]; then
    echo "arm64"
  elif [[ $machine == *"arm"* ]] || [[ $machine == *"aarch"* ]]; then
    echo "arm"
  elif [[ $machine == *"386"* ]]; then
    echo "386"
  else
    echo "amd64"
  fi
}