github.com/openimsdk/tools@v0.0.49/utils/mageutil/usage-guide/bootstrap.sh (about)

     1  #!/bin/bash
     2  
     3  if [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then
     4      TARGET_DIR="$HOME/.local/bin"
     5  else
     6      TARGET_DIR="/usr/local/bin"
     7      echo "Using /usr/local/bin as the installation directory. Might require sudo permissions."
     8  fi
     9  
    10  if ! command -v mage &> /dev/null; then
    11      echo "Installing Mage to $TARGET_DIR ..."
    12      GOBIN=$TARGET_DIR go install github.com/magefile/mage@latest
    13  fi
    14  
    15  if ! command -v mage &> /dev/null; then
    16      echo "Mage installation failed."
    17      echo "Please ensure that $TARGET_DIR is in your \$PATH."
    18      exit 1
    19  fi
    20  
    21  echo "Mage installed successfully."
    22  
    23  go mod download