check_gamedig.sh 950 B

12345678910111213141516171819
  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. 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
  8. echo -e ""
  9. echo -e "${bold}${lightyellow}Installing Gamedig${default}"
  10. fn_script_log_info "Installing Gamedig"
  11. cd "${lgsmdir}" || exit
  12. curl -L -o package.json "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/package.json"
  13. npm install
  14. elif [ "$(command -v node)" ] && [ "$(command -v npm)" ] && [ "$(node -v | cut -d 'v' -f 2 | cut -d '.' -f 1)" -ge 16 ]; then
  15. cd "${lgsmdir}" || exit
  16. curl -s -L -o package.json "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/package.json"
  17. npm update > /dev/null 2>&1
  18. fi