check_gamedig.sh 1017 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. # LinuxGSM check_gamedig.sh module
  3. # Author: Daniel Gibbs
  4. # Contributors: https://linuxgsm.com/contrib
  5. # Website: https://linuxgsm.com
  6. # Description: Installs nodejs and gamedig
  7. moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
  8. if [ "$(command -v node)" ] && [ "$(command -v npm)" ] && [ "$(node -v | cut -d 'v' -f 2 | cut -d '.' -f 1)" -ge 16 ] && [ ! -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then
  9. echo -e ""
  10. echo -e "${bold}${lightyellow}Installing Gamedig${default}"
  11. fn_script_log_info "Installing Gamedig"
  12. cd "${lgsmdir}" || exit
  13. curl -L -o package.json "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/package.json"
  14. npm install
  15. elif [ "$(command -v node)" ] && [ "$(command -v npm)" ] && [ "$(node -v | cut -d 'v' -f 2 | cut -d '.' -f 1)" -ge 16 ]; then
  16. cd "${lgsmdir}" || exit
  17. curl -s -L -o package.json "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/package.json"
  18. npm update > /dev/null 2>&1
  19. fi