From 87b8ed40f703b2b8b995cbae1bc707159d8d64a4 Mon Sep 17 00:00:00 2001 From: visdmin Date: Mon, 8 Apr 2019 00:10:17 +0300 Subject: [PATCH] fix(install): Teamspeak3 server installation with MariaDB fixed. (#2261) Co-authored-by: visdmin vili@kiho.fi fix(ts3server): can now add socket info to mariadb.ini feat(ts3server): copy libmariadb.so.2 if not found in serverfiles feat(install): EULA agreement now handled by install_eula.sh --- lgsm/functions/command_start.sh | 6 +- lgsm/functions/core_functions.sh | 15 ++--- lgsm/functions/install_complete.sh | 3 +- lgsm/functions/install_eula.sh | 45 +++++++++++++++ lgsm/functions/install_minecraft_eula.sh | 28 ---------- lgsm/functions/install_server_files.sh | 4 +- lgsm/functions/install_ts3db.sh | 55 ++++++++++--------- .../install_unreal_tournament_eula.sh | 28 ---------- 8 files changed, 83 insertions(+), 101 deletions(-) create mode 100644 lgsm/functions/install_eula.sh delete mode 100644 lgsm/functions/install_minecraft_eula.sh delete mode 100644 lgsm/functions/install_unreal_tournament_eula.sh diff --git a/lgsm/functions/command_start.sh b/lgsm/functions/command_start.sh index 447102e31..d61907ee0 100644 --- a/lgsm/functions/command_start.sh +++ b/lgsm/functions/command_start.sh @@ -32,11 +32,7 @@ fn_start_teamspeak3(){ date > "${rootdir}/${lockselfname}" # Accept license if [ ! -f "${executabledir}/.ts3server_license_accepted" ]; then - fn_script_log "Accepting ts3server license: ${executabledir}/LICENSE" - fn_print_info_nl "Accepting TeamSpeak license:" - echo " * ${executabledir}/LICENSE" - sleep 3 - touch "${executabledir}/.ts3server_license_accepted" + install_eula.sh fi cd "${executabledir}" if [ "${ts3serverpass}" == "1" ]; then diff --git a/lgsm/functions/core_functions.sh b/lgsm/functions/core_functions.sh index bde5e1f31..d28fb2ffb 100644 --- a/lgsm/functions/core_functions.sh +++ b/lgsm/functions/core_functions.sh @@ -565,32 +565,27 @@ functionfile="${FUNCNAME}" fn_fetch_function } -install_gsquery.sh(){ -functionfile="${FUNCNAME}" -fn_fetch_function -} - -install_gslt.sh(){ +install_eula.sh(){ functionfile="${FUNCNAME}" fn_fetch_function } -install_header.sh(){ +install_gsquery.sh(){ functionfile="${FUNCNAME}" fn_fetch_function } -install_logs.sh(){ +install_gslt.sh(){ functionfile="${FUNCNAME}" fn_fetch_function } -install_minecraft_eula.sh(){ +install_header.sh(){ functionfile="${FUNCNAME}" fn_fetch_function } -install_unreal_tournament_eula.sh(){ +install_logs.sh(){ functionfile="${FUNCNAME}" fn_fetch_function } diff --git a/lgsm/functions/install_complete.sh b/lgsm/functions/install_complete.sh index 9712a6bc8..18cfc16e5 100644 --- a/lgsm/functions/install_complete.sh +++ b/lgsm/functions/install_complete.sh @@ -8,6 +8,7 @@ local commandname="INSTALL" local commandaction="Install" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" +echo "" echo "=================================" echo "Install Complete!" fn_script_log_info "Install Complete!" @@ -15,4 +16,4 @@ echo "" echo "To start server type:" echo "./${selfname} start" echo "" -core_exit.sh \ No newline at end of file +core_exit.sh diff --git a/lgsm/functions/install_eula.sh b/lgsm/functions/install_eula.sh new file mode 100644 index 000000000..c2554792f --- /dev/null +++ b/lgsm/functions/install_eula.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# LinuxGSM install_eula.sh function +# Author: Daniel Gibbs +# Website: https://linuxgsm.com +# Description: Gets user to accept the EULA. + +if [ "${shortname}" == "ts3" ]; then + eulaurl="https://www.teamspeak.com/en/privacy-and-terms" +elif [ "${shortname}" == "mc" ]; then + eulaurl="https://account.mojang.com/documents/minecraft_eula" +elif [ "${shortname}" == "ut" ]; then + eulaurl="https://www.epicgames.com/unrealtournament/unreal-tournament-pre-alpha-test-development-build-eula" +fi + +echo "" +echo "Accept ${gamename} EULA" +echo "=================================" +sleep 0.5 +echo "You are required to accept the EULA:" +echo "${eulaurl}" +echo "" +if [ -z "${autoinstall}" ]; then + echo "By continuing you are indicating your agreement to the EULA." + echo "" + if ! fn_prompt_yn "Continue?" Y; then + core_exit.sh + fi +elif [ "${function_selfname}" == "command_start.sh" ]; then + fn_print_info "By continuing you are indicating your agreement to the EULA." + echo "" + sleep 5 +else + echo "By using auto-install you are indicating your agreement to the EULA." + echo "" + sleep 5 +fi + +if [ "${shortname}" == "ts3" ]; then + touch "${executabledir}/.ts3server_license_accepted" +elif [ "${shortname}" == "mc" ]; then + touch "${serverfiles}/eula.txt" + sed -i "s/eula=false/eula=true/g" "${serverfiles}/eula.txt" +elif [ "${shortname}" == "ut" ]; then + : +fi diff --git a/lgsm/functions/install_minecraft_eula.sh b/lgsm/functions/install_minecraft_eula.sh deleted file mode 100644 index 01999967f..000000000 --- a/lgsm/functions/install_minecraft_eula.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# LinuxGSM install_minecraft_eula.sh function -# Author: Daniel Gibbs -# Website: https://linuxgsm.com -# Description: Gets user to accept the EULA. - -echo "" -echo "Accept ${gamename} EULA" -echo "=================================" -sleep 0.5 -echo "You are required to accept the EULA:" -echo "https://account.mojang.com/documents/minecraft_eula" - -echo "eula=false" > "${serverfiles}/eula.txt" - -if [ -z "${autoinstall}" ]; then -echo "By continuing you are indicating your agreement to the EULA." -echo "" - if ! fn_prompt_yn "Continue?" Y; then - core_exit.sh - fi -else -echo "By using auto-install you are indicating your agreement to the EULA." -echo "" - sleep 5 -fi - -sed -i "s/eula=false/eula=true/g" "${serverfiles}/eula.txt" diff --git a/lgsm/functions/install_server_files.sh b/lgsm/functions/install_server_files.sh index 95e8f0c5f..ddaf33202 100644 --- a/lgsm/functions/install_server_files.sh +++ b/lgsm/functions/install_server_files.sh @@ -137,7 +137,7 @@ fi if [ "${shortname}" == "ts3" ]; then update_ts3.sh elif [ "${shortname}" == "mc" ]; then - install_minecraft_eula.sh + install_eula.sh update_minecraft.sh elif [ "${shortname}" == "mumble" ]; then update_mumble.sh @@ -148,7 +148,7 @@ elif [ "${shortname}" == "fctr" ]; then install_factorio_save.sh elif [ -z "${appid}" ]||[ "${shortname}" == "ges" ]||[ "${shortname}" == "bd" ]||[ "${shortname}" == "bb" ]||[ "${shortname}" == "ns" ]||[ "${shortname}" == "vs" ]; then if [ "${shortname}" == "ut" ]; then - install_unreal_tournament_eula.sh + install_eula.sh fi fn_install_server_files fi diff --git a/lgsm/functions/install_ts3db.sh b/lgsm/functions/install_ts3db.sh index ebb23c052..77dea1bae 100644 --- a/lgsm/functions/install_ts3db.sh +++ b/lgsm/functions/install_ts3db.sh @@ -10,20 +10,22 @@ local commandaction="Install" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_install_ts3db_mariadb(){ - echo "" - echo "checking if libmariadb2 is installed" - echo "=================================" - sleep 0.5 - - if ldd "${serverfiles}/libts3db_mariadb.so" | grep "libmariadb.so.2 => not found"; then - echo "libmariadb2 not installed. Please install it first." - echo "exiting..." - exit - else - echo "libmariadb2 installed." + if [ ! -f "${serverfiles}/libts3db_mariadb.so" ]; then + echo -e "copying libmariadb.so.2...\c" + cp "${serverfiles}/redist/libmariadb.so.2" "${serverfiles}" + local exitcode=$? + if [ "${exitcode}" == "0" ]; then + fn_print_ok_eol_nl + fn_script_log_pass "copying libmariadb.so.2" + else + fn_print_fail_eol_nl + fn_script_log_fatal "copying libmariadb.so.2" + core_exit.sh + fi fi + echo "" - echo "Configuring ${gamename} Server for MariaDB/MySQL" + echo "Configure ${gamename} Server for MariaDB" echo "=================================" sleep 0.5 read -rp "Enter MariaDB hostname: " mariahostname @@ -31,47 +33,46 @@ fn_install_ts3db_mariadb(){ read -rp "Enter MariaDB username: " mariausername read -rp "Enter MariaDB password: " mariapassword read -rp "Enter MariaDB database name: " mariadbname + read -rp "Enter MariaDB socket path: " mariadbsocket + { - echo "updating config." echo "[config]" echo "host='${mariahostname}'" echo "port='${mariaport}'" echo "username='${mariausername}'" echo "password='${mariapassword}'" echo "database='${mariadbname}'" - echo "socket=" + echo "socket='${mariadbsocket}'" } >> "${servercfgdir}/ts3db_mariadb.ini" sed -i "s/dbplugin=ts3db_sqlite3/dbplugin=ts3db_mariadb/g" "${servercfgfullpath}" sed -i "s/dbpluginparameter=/dbpluginparameter=ts3db_mariadb.ini/g" "${servercfgfullpath}" sed -i "s/dbsqlcreatepath=create_sqlite\//dbsqlcreatepath=create_mariadb\//g" "${servercfgfullpath}" - echo "=================================" + echo "updating ts3db_mariadb.ini." sleep 0.5 } +echo "" +echo "Select Database" +echo "=================================" +sleep 0.5 if [ -z "${autoinstall}" ]; then - echo "" - if fn_prompt_yn "Do you want to use MariaDB/MySQL instead of sqlite? (DB must be pre-configured)" N; then + if fn_prompt_yn "Do you want to use MariaDB instead of sqlite? (MariaDB must be pre-configured)" N; then fn_install_ts3db_mariadb fi else -fn_print_warning_nl "./${selfname} auto-install is uses sqlite. For MariaDB/MySQL use ./${selfname} install" +fn_print_information_nl "./${selfname} auto-install is uses sqlite. For MariaDB use ./${selfname} install" fi -## License -fn_script_log "Accepting ts3server license: ${executabledir}/LICENSE" -fn_print_information_nl "Accepting TeamSpeak license:" -echo " * ${executabledir}/LICENSE" -sleep 0.5 -touch "${executabledir}/.ts3server_license_accepted" +install_eula.sh ## Get privilege key echo "" echo "Getting privilege key" echo "=================================" sleep 0.5 -echo "IMPORANT! Save these details for later." +fn_print_information_nl "Save these details for later." sleep 0.5 cd "${executabledir}" || exit -./ts3server_startscript.sh start inifile=ts3-server.ini +${executable} start inifile=ts3-server.ini sleep 5 -./ts3server_startscript.sh stop +${executable} stop diff --git a/lgsm/functions/install_unreal_tournament_eula.sh b/lgsm/functions/install_unreal_tournament_eula.sh deleted file mode 100644 index 56fb8fbe4..000000000 --- a/lgsm/functions/install_unreal_tournament_eula.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# LinuxGSM install_unreal_tournament_eula.sh function -# Author: Daniel Gibbs -# Website: https://linuxgsm.com -# Description: Gets user to accept the EULA. - -echo "" -echo "Accept ${gamename} EULA" -echo "=================================" -sleep 0.5 -echo "You are required to accept the EULA:" -echo "https://www.epicgames.com/unrealtournament/unreal-tournament-pre-alpha-test-development-build-eula/" - -echo "eula=false" > "${serverfiles}/eula.txt" - -if [ -z "${autoinstall}" ]; then -echo "By continuing you are indicating your agreement to the EULA." -echo "" - if ! fn_prompt_yn "Continue?" Y; then - core_exit.sh - fi -else -echo "By using auto-install you are indicating your agreement to the EULA." -echo "" - sleep 5 -fi - -sed -i "s/eula=false/eula=true/g" "${serverfiles}/eula.txt"