From 171d9b45ee1e421bc48777bdf65aaef821888de6 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sat, 10 Feb 2024 23:17:29 +0000 Subject: [PATCH] install gamedig in lgsm dir if node exists --- lgsm/modules/check.sh | 7 +++++++ lgsm/modules/core_modules.sh | 5 +++++ lgsm/modules/install_gamedig.sh | 11 +++++++++++ 3 files changed, 23 insertions(+) create mode 100644 lgsm/modules/install_gamedig.sh diff --git a/lgsm/modules/check.sh b/lgsm/modules/check.sh index 1b8796e47..32fa81303 100644 --- a/lgsm/modules/check.sh +++ b/lgsm/modules/check.sh @@ -99,3 +99,10 @@ for allowed_command in "${allowed_commands_array[@]}"; do check_system_requirements.sh fi done + +allowed_commands_array=(DETAILS MONITOR START STOP UPDATE VALIDATE POST-DETAILS) +for allowed_command in "${allowed_commands_array[@]}"; do + if [ "${allowed_command}" == "${commandname}" ]; then + install_gamedig.sh + fi +done diff --git a/lgsm/modules/core_modules.sh b/lgsm/modules/core_modules.sh index 1afac30c7..4c4fb8cda 100644 --- a/lgsm/modules/core_modules.sh +++ b/lgsm/modules/core_modules.sh @@ -714,6 +714,11 @@ install_factorio_save.sh() { fn_fetch_module } +install_gamedig.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + install_dst_token.sh() { modulefile="${FUNCNAME[0]}" fn_fetch_module diff --git a/lgsm/modules/install_gamedig.sh b/lgsm/modules/install_gamedig.sh new file mode 100644 index 000000000..fdfe3a731 --- /dev/null +++ b/lgsm/modules/install_gamedig.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# LinuxGSM install_gamedig.sh module +# Author: Daniel Gibbs +# Contributors: http://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Installs nodejs and gamedig + +if [ "$(command -v node)" ] || [ ! -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then + cd "${lgsmdir}" || exit + npm install gamedig@5.0.0-beta.2 +fi