Browse Source

Merge 7de6005a02 into 1c771795ae

pull/3475/merge
C 3 years ago
committed by GitHub
parent
commit
f473a1836f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 178
      lgsm/config-default/config-lgsm/fabmcserver/_default.cfg
  2. 1
      lgsm/data/almalinux-8.csv
  3. 1
      lgsm/data/centos-7.csv
  4. 1
      lgsm/data/centos-8.csv
  5. 1
      lgsm/data/debian-10.csv
  6. 1
      lgsm/data/debian-11.csv
  7. 1
      lgsm/data/debian-9.csv
  8. 1
      lgsm/data/rhel-7.csv
  9. 1
      lgsm/data/rhel-8.csv
  10. 1
      lgsm/data/rocky-8.csv
  11. 1
      lgsm/data/serverlist.csv
  12. 1
      lgsm/data/ubuntu-16.04.csv
  13. 1
      lgsm/data/ubuntu-18.04.csv
  14. 1
      lgsm/data/ubuntu-20.04.csv
  15. 1
      lgsm/data/ubuntu-21.04.csv
  16. 1
      lgsm/data/ubuntu-22.04.csv
  17. 0
      lgsm/functions/check_deps.sh
  18. 2
      lgsm/functions/check_system_requirements.sh
  19. 2
      lgsm/functions/command_update.sh
  20. 5
      lgsm/functions/core_functions.sh
  21. 2
      lgsm/functions/info_game.sh
  22. 4
      lgsm/functions/info_messages.sh
  23. 2
      lgsm/functions/install_config.sh
  24. 4
      lgsm/functions/install_eula.sh
  25. 3
      lgsm/functions/install_server_files.sh
  26. 140
      lgsm/functions/update_fabricmc.sh

178
lgsm/config-default/config-lgsm/fabmcserver/_default.cfg

@ -0,0 +1,178 @@
##################################
######## Default Settings ########
##################################
# DO NOT EDIT, ANY CHANGES WILL BE OVERWRITTEN!
# Copy settings from here and use them in either:
# common.cfg - applies settings to every instance.
# [instance].cfg - applies settings to a specific instance.
#### Game Server Settings ####
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
javaram="1024" # -Xmx$1024M
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
startparameters="nogui"
## Release Settings | https://docs.linuxgsm.com/game-servers/minecraft#release-settings
# Version (latest|1.16.5)
mcversion="latest"
#### LinuxGSM Settings ####
## LinuxGSM Stats
# Send useful stats to LinuxGSM developers.
# https://docs.linuxgsm.com/configuration/linuxgsm-stats
# (on|off)
stats="off"
## Notification Alerts
# (on|off)
# Display IP | https://docs.linuxgsm.com/alerts#display-ip
displayip=""
# More info | https://docs.linuxgsm.com/alerts#more-info
postalert="off"
# Discord Alerts | https://docs.linuxgsm.com/alerts/discord
discordalert="off"
discordwebhook="webhook"
# Email Alerts | https://docs.linuxgsm.com/alerts/email
emailalert="off"
email="[email protected]"
emailfrom=""
# Gotify Alerts | https://docs.linuxgsm.com/alerts/gotify
gotifyalert="off"
gotifytoken="token"
gotifywebhook="webhook"
# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt
iftttalert="off"
ifttttoken="accesstoken"
iftttevent="linuxgsm_alert"
# Mailgun Email Alerts | https://docs.linuxgsm.com/alerts/mailgun
mailgunalert="off"
mailgunapiregion="us"
mailguntoken="accesstoken"
mailgundomain="example.com"
mailgunemailfrom="[email protected]"
mailgunemail="[email protected]"
# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet
pushbulletalert="off"
pushbullettoken="accesstoken"
channeltag=""
# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover
pushoveralert="off"
pushovertoken="accesstoken"
pushoveruserkey="userkey"
# Rocket.Chat Alerts | https://docs.linuxgsm.com/alerts/rocket.chat
rocketchatalert="off"
rocketchatwebhook="webhook"
rocketchattoken=""
# Slack Alerts | https://docs.linuxgsm.com/alerts/slack
slackalert="off"
slackwebhook="webhook"
# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram
# You can add a custom cURL string eg proxy (useful in Russia) in "curlcustomstring".
# For example "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help".
telegramapi="api.telegram.org"
telegramalert="off"
telegramtoken="accesstoken"
telegramchatid=""
curlcustomstring=""
## Updating | https://docs.linuxgsm.com/commands/update
updateonstart="off"
## Backup | https://docs.linuxgsm.com/commands/backup
maxbackups="4"
maxbackupdays="30"
stoponbackup="on"
## Logging | https://docs.linuxgsm.com/features/logging
consolelogging="on"
logdays="7"
## Monitor | https://docs.linuxgsm.com/commands/monitor
# Query delay time
querydelay="1"
## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors
ansi="on"
#### Advanced Settings ####
## Message Display Time | https://docs.linuxgsm.com/features/message-display-time
sleeptime="0.5"
## Stop Mode | https://docs.linuxgsm.com/features/stop-mode
# 1: tmux kill
# 2: CTRL+c
# 3: quit
# 4: quit 120s
# 5: stop
# 6: q
# 7: exit
# 8: 7 Days to Die
# 9: GoldSrc
# 10: Avorion
# 11: end
stopmode="5"
## Query mode
# 1: session only
# 2: gamedig (gsquery fallback)
# 3: gamedig
# 4: gsquery
# 5: tcp
querymode="2"
querytype="minecraft"
## Console type
consoleverbose="yes"
consoleinteract="yes"
## Game Server Details
# Do not edit
gamename="FabricMC"
engine="lwjgl2"
glibc="null"
#### Directories ####
# Edit with care
## Game Server Directories
systemdir="${serverfiles}"
executabledir="${serverfiles}"
preexecutable="java -Xmx${javaram}M -jar"
executable="./fabric-server-launch.jar"
servercfgdir="${systemdir}"
servercfg="server.properties"
servercfgdefault="server.properties"
servercfgfullpath="${servercfgdir}/${servercfg}"
## Backup Directory
backupdir="${lgsmdir}/backup"
## Logging Directories
logdir="${rootdir}/log"
gamelogdir="${systemdir}/logs"
lgsmlogdir="${logdir}/script"
consolelogdir="${logdir}/console"
lgsmlog="${lgsmlogdir}/${selfname}-script.log"
consolelog="${consolelogdir}/${selfname}-console.log"
alertlog="${lgsmlogdir}/${selfname}-alert.log"
postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log"
## Logs Naming
lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"

1
lgsm/data/almalinux-8.csv

@ -42,6 +42,7 @@ dys
eco,libgdiplus
em
etl
fabmc,java-11-openjdk
fctr
fof
gmod,ncurses-libs.i686

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/centos-7.csv

@ -42,6 +42,7 @@ dys
eco,libgdiplus
em
etl
fabmc,java-11-openjdk
fctr
fof
gmod,ncurses-libs.i686

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/centos-8.csv

@ -42,6 +42,7 @@ dys
eco,libgdiplus
em
etl
fabmc,java-11-openjdk
fctr
fof
gmod,ncurses-libs.i686

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/debian-10.csv

@ -42,6 +42,7 @@ dys
eco,libgdiplus
em
etl
fabmc,openjdk-11-jre
fctr
fof
gmod,libtinfo5:i386

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/debian-11.csv

@ -42,6 +42,7 @@ dys
eco,libgdiplus
em
etl
fabmc,openjdk-17-jre
fctr
fof
gmod,libtinfo5:i386

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/debian-9.csv

@ -42,6 +42,7 @@ dys
eco,libgdiplus
em
etl
fabmc,openjdk-8-jre
fctr
fof
gmod,libtinfo5:i386

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/rhel-7.csv

@ -42,6 +42,7 @@ dys
eco,libgdiplus
em
etl
fabmc,java-11-openjdk
fctr
fof
gmod,ncurses-libs.i686

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/rhel-8.csv

@ -42,6 +42,7 @@ dys
eco,libgdiplus
em
etl
fabmc,java-11-openjdk
fctr
fof
gmod,ncurses-libs.i686

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/rocky-8.csv

@ -42,6 +42,7 @@ dys
eco,libgdiplus
em
etl
fabmc,java-11-openjdk
fctr
fof
gmod,ncurses-libs.i686

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/serverlist.csv

@ -40,6 +40,7 @@ dys,dysserver,Dystopia
eco,ecoserver,Eco
em,emserver,Empires Mod
etl,etlserver,ET: Legacy
fabmc,fabmcserver,FabricMC
fctr,fctrserver,Factorio
fof,fofserver,Fistful of Frags
gmod,gmodserver,Garrys Mod

1 ac acserver Assetto Corsa
40 eco ecoserver Eco
41 em emserver Empires Mod
42 etl etlserver ET: Legacy
43 fabmc fabmcserver FabricMC
44 fctr fctrserver Factorio
45 fof fofserver Fistful of Frags
46 gmod gmodserver Garrys Mod

1
lgsm/data/ubuntu-16.04.csv

@ -41,6 +41,7 @@ dys
eco,libgdiplus
em
etl
fabmc,openjdk-8-jre
fctr
fof
gmod,libtinfo5:i386

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-18.04.csv

@ -42,6 +42,7 @@ dys
eco,libgdiplus
em
etl
fabmc,openjdk-11-jre
fctr
fof
gmod,libtinfo5:i386

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-20.04.csv

@ -42,6 +42,7 @@ dys
eco,libgdiplus
em
etl
fabmc,openjdk-17-jre
fctr
fof
gmod,libtinfo5:i386

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-21.04.csv

@ -42,6 +42,7 @@ dys
eco,libgdiplus
em
etl
fabmc,openjdk-17-jre
fctr
fof
gmod,libtinfo5:i386

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-22.04.csv

@ -40,6 +40,7 @@ dys
eco,libgdiplus
em
etl
fabmc,openjdk-17-jre
fctr
fof
gmod,libtinfo5:i386

Can't render this file because it has a wrong number of fields in line 2.

0
lgsm/functions/check_deps.sh

2
lgsm/functions/check_system_requirements.sh

@ -26,7 +26,7 @@ elif [ "${shortname}" == "arma3" ]; then
elif [ "${shortname}" == "rust" ]; then
ramrequirementmb="4000"
ramrequirementgb="4"
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "fabmc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then
ramrequirementmb="1000"
ramrequirementgb="1"
elif [ "${shortname}" == "pstbs" ]; then

2
lgsm/functions/command_update.sh

@ -23,6 +23,8 @@ elif [ "${shortname}" == "mcb" ]; then
update_minecraft_bedrock.sh
elif [ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then
update_papermc.sh
elif [ "${shortname}" == "fabmc" ]; then
update_fabricmc.sh
elif [ "${shortname}" == "mumble" ]; then
update_mumble.sh
elif [ "${shortname}" == "fctr" ]; then

5
lgsm/functions/core_functions.sh

@ -650,6 +650,11 @@ functionfile="${FUNCNAME[0]}"
fn_fetch_function
}
update_fabricmc.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}
update_mumble.sh(){
functionfile="${FUNCNAME[0]}"
fn_fetch_function

2
lgsm/functions/info_game.sh

@ -2367,7 +2367,7 @@ elif [ "${shortname}" == "kf2" ]; then
fn_info_game_kf2
elif [ "${shortname}" == "lo" ]; then
fn_info_game_lo
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "fabmc" ]; then
fn_info_game_mc
elif [ "${shortname}" == "mcb" ]; then
fn_info_game_mcb

4
lgsm/functions/info_messages.sh

@ -687,7 +687,7 @@ fn_info_message_ports(){
echo -e "ss -tuplwn | grep AvorionServer"
elif [ "${shortname}" == "bf1942" ]; then
echo -e "ss -tuplwn | grep bf1942_lnxded"
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "rw" ]||[ "${shortname}" == "wmc" ]; then
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "rw" ]||[ "${shortname}" == "wmc" ]||[ "${shortname}" == "fabmc" ]||; then
echo -e "ss -tuplwn | grep java"
elif [ "${shortname}" == "terraria" ]; then
echo -e "ss -tuplwn | grep Main"
@ -1712,7 +1712,7 @@ fn_info_message_select_engine(){
fn_info_message_kf2
elif [ "${shortname}" == "lo" ]; then
fn_info_message_lo
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]; then
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]||[ "${shortname}" == "wmc" ]||[ "${shortname}" == "fabmc" ]; then
fn_info_message_mc
elif [ "${shortname}" == "mcb" ]; then
fn_info_message_mcb

2
lgsm/functions/install_config.sh

@ -542,7 +542,7 @@ elif [ "${shortname}" == "l4d2" ]; then
fn_default_config_remote
fn_set_config_vars
fn_list_config_locations
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "fabmc" ]||[ "${shortname}" == "pmc" ]; then
gamedirname="Minecraft"
array_configs+=( server.properties )
fn_fetch_default_config

4
lgsm/functions/install_eula.sh

@ -9,7 +9,7 @@ functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ "${shortname}" == "ts3" ]; then
eulaurl="https://www.teamspeak.com/en/privacy-and-terms"
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "fabmc" ]||[ "${shortname}" == "pmc" ]; 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"
@ -41,7 +41,7 @@ fi
if [ "${shortname}" == "ts3" ]; then
touch "${executabledir}/.ts3server_license_accepted"
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "pmc" ]; then
elif [ "${shortname}" == "mc" ]||[ "${shortname}" == "fabmc" ]||[ "${shortname}" == "pmc" ]; then
touch "${serverfiles}/eula.txt"
echo -e "eula=true" > "${serverfiles}/eula.txt"
elif [ "${shortname}" == "ut" ]; then

3
lgsm/functions/install_server_files.sh

@ -87,6 +87,9 @@ elif [ "${shortname}" == "mcb" ]; then
elif [ "${shortname}" == "pmc" ]; then
install_eula.sh
update_papermc.sh
elif [ "${shortname}" == "fabmc" ]; then
install_eula.sh
update_fabricmc.sh
elif [ "${shortname}" == "wmc" ]; then
update_papermc.sh
elif [ "${shortname}" == "mumble" ]; then

140
lgsm/functions/update_fabricmc.sh

@ -0,0 +1,140 @@
#!/bin/bash
# LinuxGSM update_fabricmc.sh function
# Author: Ceddicedced
# Contributors: http://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Handles updating of FabricMC servers.
local commandname="UPDATE"
local commandaction="Update"
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_install_fabric(){
installername=$(echo -e "fabric-installer-${latestfabricinstaller}.jar")
installersha256=$(curl "https://${remotelocation}/net/fabricmc/fabric-installer/${latestfabricinstaller}/${installername}.sha256")
fn_fetch_file "https://${remotelocation}/net/fabricmc/fabric-installer/${latestfabricinstaller}/${installername}" "" "" "" "${tmpdir}" "fabric-installer.jar" "nochmodx" "norun" "force" "${installersha256}"
echo -e "Generating Fabric jars...\c"
java -jar ${tmpdir}/fabric-installer.jar server -dir ${serverfiles} -mcversion ${mcversion} -downloadMinecraft &> ${logdir}/script/fabric-installer.log
local exitcode=$?
if [ "${exitcode}" == "0" ]; then
fn_print_ok_eol_nl
fn_script_log_pass "Generating Fabric jars"
chmod u+x "${serverfiles}/${executable#./}"
echo "${latestfabricloader}" > "${localversionfile}"
fn_clear_tmp
else
fn_print_fail_eol_nl
fn_script_log_fatal "Generating Fabric jars with loader ${installername} and version ${mcversion}"
core_exit.sh
fi
}
fn_update_fabricmc_localbuild(){
# Gets local build info.
fn_print_dots "Checking for update: ${remotelocation}: checking local build"
sleep 0.5
if [ ! -f "${localversionfile}" ]; then
fn_print_error_nl "Checking for update: ${remotelocation}: checking local build: no local build files"
fn_script_log_error "No local build file found"
else
localbuild=$(head -n 1 "${localversionfile}")
fi
if [ -z "${localbuild}" ]; then
localbuild="0"
fn_print_error "Checking for update: ${remotelocation}: waiting for local build: missing local build info"
fn_script_log_error "Missing local build info, Set localbuild to 0"
else
fn_print_ok "Checking for update: ${remotelocation}: checking local build"
fn_script_log_pass "Checking local build"
fi
sleep 0.5
}
fn_update_fabricmc_remotebuild(){
# Gets remote build info.
latestfabricinstaller=$(curl -s https://${remotelocation}/net/fabricmc/fabric-installer/maven-metadata.xml | grep -oPm1 "(?<=<latest>)[^<]+")
latestfabricloader=$(curl -s https://${remotelocation}/net/fabricmc/fabric-loader/maven-metadata.xml | grep -oPm1 "(?<=<latest>)[^<]+")
# Checks if latestfabricloader variable has been set.
if [ -z "${latestfabricinstaller}" ]||[ -z "${latestfabricloader}" ]; then
fn_print_failure "Unable to get remote build"
fn_script_log_fatal "Unable to get remote build"
core_exit.sh
else
fn_print_ok "Latest Fabric loader version ${latestfabricloader}"
fn_script_log "Latest Fabric loader version ${latestfabricloader}"
fi
}
fn_update_fabricmc_compare(){
fn_print_dots "Checking for update: ${remotelocation}"
sleep 0.5
if [ "${localbuild}" != "${latestfabricloader}" ]||[ "${forceupdate}" == "1" ]; then
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "Update available for version ${latestfabricinstaller}"
echo -e "* Local build: ${red}${localbuild}${default}"
echo -e "* Remote build: ${green}${latestfabricloader}${default}"
fn_script_log_info "Update available for version ${mcversion}"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${latestfabricloader}"
fn_script_log_info "${localbuild} > ${latestfabricloader}"
echo -en "\n"
echo -en "applying update.\r"
echo -en "\n"
unset updateonstart
check_status.sh
# If server stopped.
if [ "${status}" == "0" ]; then
fn_install_fabric
# If server started.
else
exitbypass=1
command_stop.sh
exitbypass=1
fn_install_fabric
exitbypass=1
command_start.sh
fi
alert="update"
alert.sh
else
fn_print_ok_nl "Checking for update: ${remotelocation}"
echo -en "\n"
echo -e "No update available for version ${mcversion}"
echo -e "* Local build: ${green}${localbuild}${default}"
echo -e "* Remote build: ${green}${latestfabricloader}${default}"
fn_script_log_info "No update available"
fn_script_log_info "Local build: ${localbuild}"
fn_script_log_info "Remote build: ${latestfabricloader}"
fi
}
# The location where the builds are checked and downloaded.
remotelocation="maven.fabricmc.net"
localversionfile="${datadir}/fabricmc-version"
# check if datadir was created, if not create it
if [ ! -d "${datadir}" ]; then
mkdir -p "${datadir}"
fi
if [ "${mcversion}" == "latest" ]; then
mcversion=$(curl -s "https://launchermeta.mojang.com/mc/game/version_manifest.json" | jq -r '.latest.release')
fi
if [ "${firstcommandname}" == "INSTALL" ]; then
fn_update_fabricmc_remotebuild
fn_install_fabric
else
fn_print_dots "Checking for update: ${remotelocation}"
fn_script_log_info "Checking for update: ${remotelocation}"
sleep 0.5
fn_update_fabricmc_localbuild
fn_update_fabricmc_remotebuild
fn_update_fabricmc_compare
fi
Loading…
Cancel
Save