From 2cafed8264a865e76fdf1cfa6f9247c2119706e9 Mon Sep 17 00:00:00 2001 From: Ezra Dowd Date: Mon, 16 Feb 2026 17:53:37 +0000 Subject: [PATCH] feat(cfmc): add support for CurseForge Minecraft server packs --- .../config-lgsm/cfmcserver/_default.cfg | 189 +++++++ lgsm/data/almalinux-8.csv | 1 + lgsm/data/almalinux-9.csv | 1 + lgsm/data/centos-7.csv | 1 + lgsm/data/centos-8.csv | 1 + lgsm/data/centos-9.csv | 1 + lgsm/data/debian-10.csv | 1 + lgsm/data/debian-11.csv | 1 + lgsm/data/debian-12.csv | 1 + lgsm/data/debian-13.csv | 1 + lgsm/data/debian-9.csv | 1 + lgsm/data/gameicons/cfmc-icon.png | Bin 0 -> 2423 bytes lgsm/data/rhel-7.csv | 1 + lgsm/data/rhel-8.csv | 1 + lgsm/data/rhel-9.csv | 1 + lgsm/data/rocky-8.csv | 1 + lgsm/data/rocky-9.csv | 1 + lgsm/data/serverlist.csv | 1 + lgsm/data/ubuntu-16.04.csv | 1 + lgsm/data/ubuntu-18.04.csv | 1 + lgsm/data/ubuntu-20.04.csv | 1 + lgsm/data/ubuntu-22.04.csv | 1 + lgsm/data/ubuntu-23.04.csv | 1 + lgsm/data/ubuntu-23.10.csv | 1 + lgsm/data/ubuntu-24.04.csv | 1 + lgsm/modules/check_system_requirements.sh | 2 + lgsm/modules/command_check_update.sh | 2 + lgsm/modules/command_update.sh | 2 + lgsm/modules/core_modules.sh | 5 + lgsm/modules/info_game.sh | 2 +- lgsm/modules/info_messages.sh | 4 +- lgsm/modules/install_config.sh | 2 + lgsm/modules/install_eula.sh | 4 +- lgsm/modules/install_server_files.sh | 4 +- lgsm/modules/update_cfmc.sh | 463 ++++++++++++++++++ 35 files changed, 696 insertions(+), 6 deletions(-) create mode 100644 lgsm/config-default/config-lgsm/cfmcserver/_default.cfg create mode 100644 lgsm/data/gameicons/cfmc-icon.png create mode 100644 lgsm/modules/update_cfmc.sh diff --git a/lgsm/config-default/config-lgsm/cfmcserver/_default.cfg b/lgsm/config-default/config-lgsm/cfmcserver/_default.cfg new file mode 100644 index 0000000000..24bddfc603 --- /dev/null +++ b/lgsm/config-default/config-lgsm/cfmcserver/_default.cfg @@ -0,0 +1,189 @@ +################################## +######## 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" + +## CurseForge Settings +# Source mode (api|url) +cfmcsource="api" +# CurseForge project ID. +curseforgemodid="" +# CurseForge file ID. +curseforgefileid="" +# Direct archive URL or CurseForge file page URL. +curseforgeurl="" +# Start mode (auto|manual) +cfmcstartmode="auto" +# Extra paths to preserve during updates, separated by semicolons. +cfmcpreservepaths="" +# Set "curseforgeapikey" in secrets-common.cfg or secrets-${selfname}.cfg. + +#### 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" + +# Alert on Start/Stop/Restart +statusalert="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@example.com" +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" + +# 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" + +# 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 all". +telegramapi="api.telegram.org" +telegramalert="off" +telegramtoken="accesstoken" +telegramchatid="" +telegramthreadid="" +telegramsilentnotification="false" +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="CurseForge Minecraft" +engine="lwjgl2" +glibc="null" + +#### Directories #### +# Edit with care + +## Game Server Directories +systemdir="${serverfiles}" +executabledir="${serverfiles}" +preexecutable="java -Xmx${javaram}M -jar" +executable="./minecraft_server.jar" +servercfgdir="${systemdir}" +servercfg="server.properties" +servercfgdefault="" +servercfgfullpath="${servercfgdir}/${servercfg}" + +## Backup Directory +backupdir="${lgsmdir}/backup" + +## Logging Directories +[ -n "${LGSM_LOGDIR}" ] && logdir="${LGSM_LOGDIR}" || 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" + +## Log Parameters +logtimestamp="off" +logtimestampformat="%Y-%m-%d %H:%M:%S" diff --git a/lgsm/data/almalinux-8.csv b/lgsm/data/almalinux-8.csv index 2405a4b3ee..4a667d22ab 100644 --- a/lgsm/data/almalinux-8.csv +++ b/lgsm/data/almalinux-8.csv @@ -19,6 +19,7 @@ bs bt,libicu,dos2unix,libxml2 btl cc +cfmc,java-21-openjdk ck,xorg-x11-server-Xvfb cmw cod,compat-libstdc++-33.i686 diff --git a/lgsm/data/almalinux-9.csv b/lgsm/data/almalinux-9.csv index 069e8e437e..68010d88b3 100644 --- a/lgsm/data/almalinux-9.csv +++ b/lgsm/data/almalinux-9.csv @@ -19,6 +19,7 @@ bs bt,libicu,dos2unix,libxml2 btl cc +cfmc,java-21-openjdk ck,xorg-x11-server-Xvfb cmw cod,compat-libstdc++-33.i686 diff --git a/lgsm/data/centos-7.csv b/lgsm/data/centos-7.csv index 39af5868df..0855ee0a65 100644 --- a/lgsm/data/centos-7.csv +++ b/lgsm/data/centos-7.csv @@ -19,6 +19,7 @@ bs bt,libicu,dos2unix,libxml2 btl cc +cfmc,java-21-openjdk ck,xorg-x11-server-Xvfb cmw cod,compat-libstdc++-33.i686 diff --git a/lgsm/data/centos-8.csv b/lgsm/data/centos-8.csv index bcaf1e31da..1c2c9b8ad4 100644 --- a/lgsm/data/centos-8.csv +++ b/lgsm/data/centos-8.csv @@ -19,6 +19,7 @@ bs bt,libicu,dos2unix,libxml2 btl cc +cfmc,java-21-openjdk ck,xorg-x11-server-Xvfb cmw cod,compat-libstdc++-33.i686 diff --git a/lgsm/data/centos-9.csv b/lgsm/data/centos-9.csv index 446a55ebb5..c804f1a4c8 100644 --- a/lgsm/data/centos-9.csv +++ b/lgsm/data/centos-9.csv @@ -19,6 +19,7 @@ bs bt,libicu,dos2unix,libxml2 btl cc +cfmc,java-17-openjdk ck,xorg-x11-server-Xvfb cmw cod,compat-libstdc++-33.i686 diff --git a/lgsm/data/debian-10.csv b/lgsm/data/debian-10.csv index e0c6ea7e47..c344fb62d6 100644 --- a/lgsm/data/debian-10.csv +++ b/lgsm/data/debian-10.csv @@ -18,6 +18,7 @@ bs bt,libicu-dev,dos2unix,libxml2-utils btl cc +cfmc,openjdk-11-jre ck,xvfb,libxi6 cmw cod,libstdc++5:i386 diff --git a/lgsm/data/debian-11.csv b/lgsm/data/debian-11.csv index 0d26522932..6a0e050366 100644 --- a/lgsm/data/debian-11.csv +++ b/lgsm/data/debian-11.csv @@ -19,6 +19,7 @@ bs bt,libicu-dev,dos2unix,libxml2-utils btl cc +cfmc,openjdk-17-jre ck,xvfb,libxi6 cmw cod,libstdc++5:i386 diff --git a/lgsm/data/debian-12.csv b/lgsm/data/debian-12.csv index e67a822b79..2689c45bb9 100644 --- a/lgsm/data/debian-12.csv +++ b/lgsm/data/debian-12.csv @@ -19,6 +19,7 @@ bs bt,libicu-dev,dos2unix,libxml2-utils btl cc +cfmc,openjdk-17-jre ck,xvfb,libxi6 cmw cod,libstdc++5:i386 diff --git a/lgsm/data/debian-13.csv b/lgsm/data/debian-13.csv index 2ca56633f8..1d4d0712c8 100644 --- a/lgsm/data/debian-13.csv +++ b/lgsm/data/debian-13.csv @@ -19,6 +19,7 @@ bs bt,libicu-dev,dos2unix,libxml2-utils btl cc +cfmc,openjdk-25-jre ck,xvfb,libxi6 cmw cod,libstdc++5:i386 diff --git a/lgsm/data/debian-9.csv b/lgsm/data/debian-9.csv index a111c68009..9903a35ced 100644 --- a/lgsm/data/debian-9.csv +++ b/lgsm/data/debian-9.csv @@ -19,6 +19,7 @@ bs bt,libicu-dev,dos2unix,libxml2-utils btl cc +cfmc,openjdk-8-jre ck,xvfb,libxi6 cmw cod,libstdc++5:i386 diff --git a/lgsm/data/gameicons/cfmc-icon.png b/lgsm/data/gameicons/cfmc-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ad6904d9cb10e5776dd8c5ba8c85beb2a8a16162 GIT binary patch literal 2423 zcmV--35fQIP)004R>004l5008;`004mK004C`008P>0026e000+ooVrmw00006 zVoOIv0RI600RN!9r;`8x00(qQO+^Ri3J?(qBeQ+Y*Z=?sdr3q=R9M5c*Gr6DN14F! zf7Llv=W!o>`*z#0)9J)9atIJ9VgwQ+q9{>VzzWzQMPdVNvta>(1cBHvMr_zHi-|N6 zlLbLUvzutp3}_e@tUwVW!A@+eZTHiCU+11@y=HOa7MV_zU_q_xobOlP_noR!5%)MQ zeP&&J;ai`0dh4-KcI7t*$M^akaWBt&>Bs-@Oxv|D^m_RdX_~g%gRP%me`Ejhzdrx# zKLO$I1rT5U$)}!?v3NlUp70?^YaId@57(I%^IG`m=Zn4i^1pxo_a7MYzJLplpA}#H z_9vfl!9Jg&o=lY%L4b9RNi`#jQ>M!~GLoceigHn-I`wjSY%c%vH-7oPkoN?9_Un(y z(L>48NvdAZiGI>{R&1_~Ar^F1OJy6*_BU|Ou|GXx(C;zsjkvRzV6CI>nxDcIx8D;~n9o`^G6SmjS6MW#- zY@bL*XfIhGj+r)dih7BZQPY;)&yH>^e)yk1dgB!21n{LFd`hlw^`DY5yb$~7DJ>#e zXDEG5nr7$_<7>-kJff}}_KQPwlJMa8e&%Jtw3;y*t>e9?Z5qnDCOAhDCHN3{VDo$v z+VJv?D+mAd)9?Q8>vtj1+wtY&pL_7te5Aie;KJ7U9BG9K-$^Yx#g%M|)(k=7G)g+&tdJ z7{j^E`$!{AwhPR7K78*AMZ^@!+HP5tP7q zLmF!$DH&!1bfhSnB}KKQm*l8Kv9vWuJ6B0W%GtF|vOJ|QCA~Q3t=${kxlwRKH$^M%~n0``s=sHJrULA{)kxvk{396s%1m7A9(AxQ@YmBbrvDO&n)aaP5~zWbAa5~qN^=SS7UE=g!?21Z_XL6 z4`91w7<*&^S)8ytJ-|6f+jXQW3_OUrc*>K zxc>Sc)7_GX9zILlhgfRnI}2|8@c`*0^^KbNydqT4IYZ-G{8W+4h%}2yRD|>XG~nTL zV}5^im!`A0(s3rFlyyf@Tk5h#dquCGv7DDorZe{T59#%LOm-@S6=<(9!4O=)S02|` zOwqw25GM&9kMja!1&y(%0RiY`nz}J~Js^=5Up5Rf&FqbuV;xzdSRZ6)6>~HzX}i_R>(-nG_z;kh zVCQhkAW!H^kJm9D+S;UP4TrNOwG|*E#wO#=YZYmxSj+<23ATp=W<`UH1yTwwoLi@; zTFS=ISx*S7RZA(z5_JNQe|az@I%cw{m=!g~IuL@J2U7yj&k`OUYjo%k2y_$?2SLvn z5@BeKL+C!O@gypyYz?h-M3JQF3>(9ojnM$1dQ{E3WPkw1dN$X3^is|4@q!QnZRb!b zqUkJa{ggb_80YBcnlo#C_NKc?3D$X3uTM-&RW-E6k|hdj9o`3A2y_-Y=V>}~Is@}% z&Ag}yA<)Y-n`=D=c}g!;Sm)VT%URYft+9jh*n#y^{eL0MqD_fIhYm< z@`TPfb`EEZ`Wc;dEUK1BO5#WmN0Kw69@7SD4^7oz-KsD8nWpY6;V*tkPD-Fu#IkDf zepS!?<5e*0JR(-is~RZt2p$2_ zHYAi~NgyDFM5`F*R}E;Yg2l3=a~^9P&aZl-GnRnBI*$|rA0U!~0JDQh@#6Kv#aA2S zUIF|&G5}CCX7c*YJO8m*Rb%cWP2HK<{-pSqH}_^=n^)bx0q?j)y#sLaNmk}~=VFFS zoBc}{&ySzearEpUPe#^x`foSrwf!kgYuQ}Ou|9A-uVyo+U%Gw!_K$(9-0Q{U-R7Pd zB$qyZ>Hg=&!~9um+{goalO?H&soHL~Hz{7)IVwI-;Clg_JacxKT)K4s=5w9%&l=~s zGh4oNYf}DIf&Ugm=s3D41Q+jdApraz+ep5RoFx^f0000bbVXQnWMOn=I%9HWVRU5x zGB7eTEio`HF*Z~&HaaslIx{ybFfckWFlLHF(*OVfC3HntbYx+4WjbwdWNBu305UK# pGc7SNEipD!F)}(dFgi3jD=;uRFfggHhIs%0002ovPDHLkV1h-Md1L?p literal 0 HcmV?d00001 diff --git a/lgsm/data/rhel-7.csv b/lgsm/data/rhel-7.csv index 26420d76f8..b36bbab92b 100644 --- a/lgsm/data/rhel-7.csv +++ b/lgsm/data/rhel-7.csv @@ -20,6 +20,7 @@ bs bt,libicu,dos2unix,libxml2 btl cc +cfmc,java-11-openjdk ck,xorg-x11-server-Xvfb cmw cod,compat-libstdc++-33.i686 diff --git a/lgsm/data/rhel-8.csv b/lgsm/data/rhel-8.csv index 9515a12aca..e1fd6c24ca 100644 --- a/lgsm/data/rhel-8.csv +++ b/lgsm/data/rhel-8.csv @@ -19,6 +19,7 @@ bs bt,libicu,dos2unix,libxml2 btl cc +cfmc,java-21-openjdk ck,xorg-x11-server-Xvfb cmw cod,compat-libstdc++-33.i686 diff --git a/lgsm/data/rhel-9.csv b/lgsm/data/rhel-9.csv index 069e8e437e..68010d88b3 100644 --- a/lgsm/data/rhel-9.csv +++ b/lgsm/data/rhel-9.csv @@ -19,6 +19,7 @@ bs bt,libicu,dos2unix,libxml2 btl cc +cfmc,java-21-openjdk ck,xorg-x11-server-Xvfb cmw cod,compat-libstdc++-33.i686 diff --git a/lgsm/data/rocky-8.csv b/lgsm/data/rocky-8.csv index 9515a12aca..e1fd6c24ca 100644 --- a/lgsm/data/rocky-8.csv +++ b/lgsm/data/rocky-8.csv @@ -19,6 +19,7 @@ bs bt,libicu,dos2unix,libxml2 btl cc +cfmc,java-21-openjdk ck,xorg-x11-server-Xvfb cmw cod,compat-libstdc++-33.i686 diff --git a/lgsm/data/rocky-9.csv b/lgsm/data/rocky-9.csv index 069e8e437e..68010d88b3 100644 --- a/lgsm/data/rocky-9.csv +++ b/lgsm/data/rocky-9.csv @@ -19,6 +19,7 @@ bs bt,libicu,dos2unix,libxml2 btl cc +cfmc,java-21-openjdk ck,xorg-x11-server-Xvfb cmw cod,compat-libstdc++-33.i686 diff --git a/lgsm/data/serverlist.csv b/lgsm/data/serverlist.csv index 49d7b1d105..3a03048371 100644 --- a/lgsm/data/serverlist.csv +++ b/lgsm/data/serverlist.csv @@ -18,6 +18,7 @@ bs,bsserver,Blade Symphony,ubuntu-24.04 bt,btserver,Barotrauma,ubuntu-24.04 btl,btlserver,BATTALION: Legacy,ubuntu-20.04 cc,ccserver,Codename CURE,ubuntu-24.04 +cfmc,cfmcserver,CurseForge Minecraft,ubuntu-24.04 ck,ckserver,Core Keeper,ubuntu-24.04 cmw,cmwserver,Chivalry: Medieval Warfare,ubuntu-24.04 cod,codserver,Call of Duty,ubuntu-24.04 diff --git a/lgsm/data/ubuntu-16.04.csv b/lgsm/data/ubuntu-16.04.csv index 844903c3a8..b210e8bb3b 100644 --- a/lgsm/data/ubuntu-16.04.csv +++ b/lgsm/data/ubuntu-16.04.csv @@ -20,6 +20,7 @@ bs bt,libicu-dev,dos2unix,libxml2-utils btl cc +cfmc,openjdk-8-jre ck,xvfb,libxi6 cmw cod,libstdc++5:i386 diff --git a/lgsm/data/ubuntu-18.04.csv b/lgsm/data/ubuntu-18.04.csv index b058c3024d..567ff5f809 100644 --- a/lgsm/data/ubuntu-18.04.csv +++ b/lgsm/data/ubuntu-18.04.csv @@ -20,6 +20,7 @@ bs bt,libicu-dev,dos2unix,libxml2-utils btl cc +cfmc,openjdk-11-jre ck,xvfb,libxi6 cmw cod,libstdc++5:i386 diff --git a/lgsm/data/ubuntu-20.04.csv b/lgsm/data/ubuntu-20.04.csv index dc54ea10f2..b4ee84c366 100644 --- a/lgsm/data/ubuntu-20.04.csv +++ b/lgsm/data/ubuntu-20.04.csv @@ -19,6 +19,7 @@ bs bt,libicu-dev,dos2unix,libxml2-utils btl cc +cfmc,openjdk-21-jre ck,xvfb,libxi6 cmw cod,libstdc++5:i386 diff --git a/lgsm/data/ubuntu-22.04.csv b/lgsm/data/ubuntu-22.04.csv index 46c036e1b5..b945e25312 100644 --- a/lgsm/data/ubuntu-22.04.csv +++ b/lgsm/data/ubuntu-22.04.csv @@ -19,6 +19,7 @@ bs bt,libicu-dev,dos2unix,libxml2-utils btl cc +cfmc,openjdk-21-jre ck,xvfb,libxi6 cmw cod,libstdc++5:i386 diff --git a/lgsm/data/ubuntu-23.04.csv b/lgsm/data/ubuntu-23.04.csv index ca84edf295..764923cb8c 100644 --- a/lgsm/data/ubuntu-23.04.csv +++ b/lgsm/data/ubuntu-23.04.csv @@ -19,6 +19,7 @@ bs bt,libicu-dev,dos2unix,libxml2-utils btl cc +cfmc,openjdk-21-jre ck,xvfb,libxi6 cmw cod,libstdc++5:i386 diff --git a/lgsm/data/ubuntu-23.10.csv b/lgsm/data/ubuntu-23.10.csv index ca84edf295..764923cb8c 100644 --- a/lgsm/data/ubuntu-23.10.csv +++ b/lgsm/data/ubuntu-23.10.csv @@ -19,6 +19,7 @@ bs bt,libicu-dev,dos2unix,libxml2-utils btl cc +cfmc,openjdk-21-jre ck,xvfb,libxi6 cmw cod,libstdc++5:i386 diff --git a/lgsm/data/ubuntu-24.04.csv b/lgsm/data/ubuntu-24.04.csv index d130d68c48..5933fbb669 100644 --- a/lgsm/data/ubuntu-24.04.csv +++ b/lgsm/data/ubuntu-24.04.csv @@ -19,6 +19,7 @@ bs bt,libicu-dev,dos2unix,libxml2-utils btl cc +cfmc,openjdk-21-jre ck,xvfb,libxi6 cmw cod,libstdc++5:i386 diff --git a/lgsm/modules/check_system_requirements.sh b/lgsm/modules/check_system_requirements.sh index 39cef3a42b..65c3a15f73 100644 --- a/lgsm/modules/check_system_requirements.sh +++ b/lgsm/modules/check_system_requirements.sh @@ -35,6 +35,8 @@ elif [ "${shortname}" == "mc" ]; then ramrequirementgb="1" elif [ "${shortname}" == "pmc" ]; then ramrequirementgb="2" +elif [ "${shortname}" == "cfmc" ]; then + ramrequirementgb="4" elif [ "${shortname}" == "mh" ]; then ramrequirementgb="4" elif [ "${shortname}" == "ns2" ] || [ "${shortname}" == "ns2c" ]; then diff --git a/lgsm/modules/command_check_update.sh b/lgsm/modules/command_check_update.sh index 38f8b4ddc6..e1eabd9a75 100644 --- a/lgsm/modules/command_check_update.sh +++ b/lgsm/modules/command_check_update.sh @@ -18,6 +18,8 @@ if [ "${shortname}" == "ts3" ]; then update_ts3.sh elif [ "${shortname}" == "mc" ]; then update_mc.sh +elif [ "${shortname}" == "cfmc" ]; then + update_cfmc.sh elif [ "${shortname}" == "mcb" ]; then update_mcb.sh elif [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then diff --git a/lgsm/modules/command_update.sh b/lgsm/modules/command_update.sh index 6bb30a4c8e..f86a3f0722 100644 --- a/lgsm/modules/command_update.sh +++ b/lgsm/modules/command_update.sh @@ -19,6 +19,8 @@ if [ "${shortname}" == "ts3" ]; then update_ts3.sh elif [ "${shortname}" == "mc" ]; then update_mc.sh +elif [ "${shortname}" == "cfmc" ]; then + update_cfmc.sh elif [ "${shortname}" == "mcb" ]; then update_mcb.sh elif [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then diff --git a/lgsm/modules/core_modules.sh b/lgsm/modules/core_modules.sh index 614f5d019e..735b983020 100644 --- a/lgsm/modules/core_modules.sh +++ b/lgsm/modules/core_modules.sh @@ -670,6 +670,11 @@ update_mc.sh() { fn_fetch_module } +update_cfmc.sh() { + modulefile="${FUNCNAME[0]}" + fn_fetch_module +} + update_mcb.sh() { modulefile="${FUNCNAME[0]}" fn_fetch_module diff --git a/lgsm/modules/info_game.sh b/lgsm/modules/info_game.sh index 0b43ba6261..354ff13afb 100644 --- a/lgsm/modules/info_game.sh +++ b/lgsm/modules/info_game.sh @@ -2387,7 +2387,7 @@ elif [ "${shortname}" == "kf" ]; then fn_info_game_kf elif [ "${shortname}" == "kf2" ]; then fn_info_game_kf2 -elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then +elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "cfmc" ] || [ "${shortname}" == "pmc" ]; then fn_info_game_mc elif [ "${shortname}" == "mcb" ]; then fn_info_game_mcb diff --git a/lgsm/modules/info_messages.sh b/lgsm/modules/info_messages.sh index 242c6b3372..85c33c8b49 100644 --- a/lgsm/modules/info_messages.sh +++ b/lgsm/modules/info_messages.sh @@ -754,7 +754,7 @@ fn_info_messages_ports() { portcommand="ss -tuplwn | grep enfMain" elif [ "${shortname}" == "q4" ]; then portcommand="ss -tuplwn | grep q4ded.x86" - elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "nec" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then + elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "cfmc" ] || [ "${shortname}" == "nec" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then portcommand="ss -tuplwn | grep java" elif [ "${shortname}" == "terraria" ]; then portcommand="ss -tuplwn | grep Main" @@ -1874,7 +1874,7 @@ fn_info_messages_select_engine() { fn_info_messages_kf elif [ "${shortname}" == "kf2" ]; then fn_info_messages_kf2 - elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "wmc" ]; then + elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "cfmc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "wmc" ]; then fn_info_messages_mc elif [ "${shortname}" == "mcb" ]; then fn_info_messages_mcb diff --git a/lgsm/modules/install_config.sh b/lgsm/modules/install_config.sh index b73e7b4b26..911ddf4e8d 100644 --- a/lgsm/modules/install_config.sh +++ b/lgsm/modules/install_config.sh @@ -537,6 +537,8 @@ elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then fn_default_config_remote fn_set_config_vars fn_list_config_locations +elif [ "${shortname}" == "cfmc" ]; then + fn_list_config_locations elif [ "${shortname}" == "mcb" ]; then array_configs+=(server.properties) fn_default_config_remote diff --git a/lgsm/modules/install_eula.sh b/lgsm/modules/install_eula.sh index f32a1931e1..07e878a01a 100644 --- a/lgsm/modules/install_eula.sh +++ b/lgsm/modules/install_eula.sh @@ -9,7 +9,7 @@ moduleselfname="$(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}" == "cfmc" ] || [ "${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" @@ -38,7 +38,7 @@ fi if [ "${shortname}" == "ts3" ]; then touch "${executabledir}/.ts3server_license_accepted" -elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ]; then +elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "cfmc" ] || [ "${shortname}" == "pmc" ]; then touch "${serverfiles}/eula.txt" echo -e "eula=true" > "${serverfiles}/eula.txt" elif [ "${shortname}" == "ut" ]; then diff --git a/lgsm/modules/install_server_files.sh b/lgsm/modules/install_server_files.sh index c667a7fe49..dd58452de0 100644 --- a/lgsm/modules/install_server_files.sh +++ b/lgsm/modules/install_server_files.sh @@ -241,7 +241,7 @@ fn_install_server_files() { fn_clear_tmp } -if [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "ut" ]; then +if [ "${shortname}" == "mc" ] || [ "${shortname}" == "cfmc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "ut" ]; then install_eula.sh fi @@ -260,6 +260,8 @@ if [ "${shortname}" == "ts3" ]; then update_ts3.sh elif [ "${shortname}" == "mc" ]; then update_mc.sh +elif [ "${shortname}" == "cfmc" ]; then + update_cfmc.sh elif [ "${shortname}" == "mcb" ]; then update_mcb.sh elif [ "${shortname}" == "pmc" ]; then diff --git a/lgsm/modules/update_cfmc.sh b/lgsm/modules/update_cfmc.sh new file mode 100644 index 0000000000..68185ac815 --- /dev/null +++ b/lgsm/modules/update_cfmc.sh @@ -0,0 +1,463 @@ +#!/bin/bash +# LinuxGSM update_cfmc.sh module +# Author: Daniel Gibbs +# Contributors: https://linuxgsm.com/contrib +# Website: https://linuxgsm.com +# Description: Handles updating of CurseForge Minecraft server packs. + +moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" + +fn_cfmc_parse_fileid_from_url() { + local input_url="${1}" + echo "${input_url}" | sed -n 's#.*[\/?&]files/\([0-9]\+\).*#\1#p' | head -n 1 +} + +fn_cfmc_validate_config() { + cfmcsource="${cfmcsource:-api}" + local parsed_fileid + local missing_settings=() + + if [ "${cfmcsource}" != "api" ] && [ "${cfmcsource}" != "url" ]; then + fn_print_failure "Invalid cfmcsource: ${cfmcsource}" + fn_script_log_fail "Invalid cfmcsource: ${cfmcsource}" + echo -e "Supported values: api | url" + echo -e "Set in: ${configdirserver}/${selfname}.cfg" + core_exit.sh + fi + + if [ -n "${curseforgeurl}" ]; then + parsed_fileid="$(fn_cfmc_parse_fileid_from_url "${curseforgeurl}")" + if [ -n "${parsed_fileid}" ] && [ -z "${curseforgefileid}" ]; then + curseforgefileid="${parsed_fileid}" + fi + fi + + if [ "${cfmcsource}" == "api" ]; then + [ -n "${curseforgemodid}" ] || missing_settings+=("curseforgemodid") + [ -n "${curseforgefileid}" ] || missing_settings+=("curseforgefileid") + [ -n "${curseforgeapikey}" ] || missing_settings+=("curseforgeapikey") + elif [ "${cfmcsource}" == "url" ]; then + [ -n "${curseforgeurl}" ] || missing_settings+=("curseforgeurl") + fi + + if [ "${#missing_settings[@]}" -gt 0 ]; then + fn_print_failure "Missing required CurseForge settings" + fn_script_log_fail "Missing required CurseForge settings" + echo -e "Set the following value(s):" + for setting in "${missing_settings[@]}"; do + echo -e "* ${setting}" + done + echo -e "" + echo -e "Set non-secret values in: ${configdirserver}/${selfname}.cfg" + echo -e "Set curseforgeapikey in: ${configdirserver}/secrets-common.cfg or ${configdirserver}/secrets-${selfname}.cfg" + core_exit.sh + fi +} + +fn_cfmc_api_get_file_data() { + local fileid="${1}" + local apiurl="https://api.curseforge.com/v1/mods/${curseforgemodid}/files/${fileid}" + local apiresponse + local apiid + + apiresponse=$(curl -sSL -H "x-api-key: ${curseforgeapikey}" "${apiurl}") + exitcode=$? + if [ "${exitcode}" -ne 0 ] || [ -z "${apiresponse}" ]; then + fn_print_failure "Unable to query CurseForge API for file ID ${fileid}" + fn_script_log_fail "Unable to query CurseForge API for file ID ${fileid}" + core_exit.sh + fi + + apiid=$(echo "${apiresponse}" | jq -r '.data.id // empty') + if [ -z "${apiid}" ]; then + fn_print_failure "Unable to resolve CurseForge file ID ${fileid}" + fn_script_log_fail "Unable to resolve CurseForge file ID ${fileid}" + core_exit.sh + fi + + echo "${apiresponse}" +} + +fn_cfmc_resolve_api_source() { + local source_fileid="${1:-${curseforgefileid}}" + local apiresponse + local server_pack_fileid + + apiresponse="$(fn_cfmc_api_get_file_data "${source_fileid}")" + server_pack_fileid=$(echo "${apiresponse}" | jq -r '.data.serverPackFileId // 0') + resolvedfileid="${source_fileid}" + + if [[ "${server_pack_fileid}" =~ ^[0-9]+$ ]] && [ "${server_pack_fileid}" -gt 0 ]; then + resolvedfileid="${server_pack_fileid}" + apiresponse="$(fn_cfmc_api_get_file_data "${resolvedfileid}")" + fi + + remotebuildurl=$(echo "${apiresponse}" | jq -r '.data.downloadUrl // empty') + remotebuildfilename=$(echo "${apiresponse}" | jq -r '.data.fileName // empty') + + if [ -z "${remotebuildfilename}" ] || [ "${remotebuildfilename}" == "null" ]; then + remotebuildfilename="curseforge-${resolvedfileid}.zip" + fi + + if [ -z "${remotebuildurl}" ] || [ "${remotebuildurl}" == "null" ]; then + fn_print_failure "CurseForge API did not return a downloadable server pack URL for file ${resolvedfileid}" + fn_script_log_fail "CurseForge API did not return a downloadable server pack URL for file ${resolvedfileid}" + core_exit.sh + fi + + remotelocation="curseforge.com" + localpackpath="" +} + +fn_cfmc_resolve_url_source() { + local parsed_fileid + parsed_fileid="$(fn_cfmc_parse_fileid_from_url "${curseforgeurl}")" + + if echo "${curseforgeurl}" | grep -Eq '^https?://(www\.)?curseforge\.com/'; then + if [ -z "${parsed_fileid}" ]; then + fn_print_failure "Unsupported CurseForge URL: ${curseforgeurl}" + fn_script_log_fail "Unsupported CurseForge URL: ${curseforgeurl}" + echo -e "Use a direct archive URL, local archive path, or a CurseForge URL containing /files/." + core_exit.sh + fi + if [ -z "${curseforgemodid}" ] || [ -z "${curseforgeapikey}" ]; then + fn_print_failure "CurseForge page URL requires curseforgemodid and curseforgeapikey" + fn_script_log_fail "CurseForge page URL requires curseforgemodid and curseforgeapikey" + echo -e "Set non-secret values in: ${configdirserver}/${selfname}.cfg" + echo -e "Set curseforgeapikey in: ${configdirserver}/secrets-common.cfg or ${configdirserver}/secrets-${selfname}.cfg" + core_exit.sh + fi + curseforgefileid="${parsed_fileid}" + fn_cfmc_resolve_api_source "${parsed_fileid}" + return + fi + + if echo "${curseforgeurl}" | grep -Eq '^https?://'; then + local url_no_query="${curseforgeurl%%\?*}" + remotebuildfilename="$(basename "${url_no_query}")" + if [ -z "${remotebuildfilename}" ] || [ "${remotebuildfilename}" == "/" ] || [ "${remotebuildfilename}" == "." ]; then + remotebuildfilename="curseforge-server-pack.zip" + fi + remotebuildurl="${curseforgeurl}" + remotelocation="$(echo "${curseforgeurl}" | awk -F/ '{print $3}')" + resolvedsource="${curseforgeurl}" + localpackpath="" + elif [ -f "${curseforgeurl}" ]; then + localpackpath="${curseforgeurl}" + remotebuildfilename="$(basename "${localpackpath}")" + remotebuildurl="" + remotelocation="local file" + resolvedsource="${localpackpath}" + else + fn_print_failure "Invalid curseforgeurl value: ${curseforgeurl}" + fn_script_log_fail "Invalid curseforgeurl value: ${curseforgeurl}" + echo -e "Set curseforgeurl to a direct archive URL, a local archive path, or a CurseForge file page URL." + core_exit.sh + fi +} + +fn_cfmc_build_remote_marker() { + local marker_source + local sourcehash + + if [ "${cfmcsource}" == "api" ]; then + remotebuildversion="cfapi:${curseforgemodid}:${resolvedfileid}" + else + marker_source="${curseforgeurl}" + if [ -z "${marker_source}" ]; then + marker_source="${resolvedsource}" + fi + sourcehash=$(echo -n "${marker_source}" | sha1sum | awk '{print $1}') + remotebuildversion="cfurl:${sourcehash}" + fi +} + +fn_cfmc_collect_preserve_paths() { + local levelname + local preserve_entries + local preserve_path + local preserve_raw_paths=() + + cfmc_preserve_paths=() + levelname=$(sed -n -e 's/^level-name=//p' "${serverfiles}/server.properties" 2> /dev/null | tail -n 1) + if [ -z "${levelname}" ]; then + levelname="world" + fi + + preserve_entries="local;journeymap;kubejs;serverconfig;server.properties;eula.txt;ops.json;whitelist.json;banned-ips.json;banned-players.json;usercache.json;${levelname};${levelname}_nether;${levelname}_the_end;${cfmcpreservepaths}" + IFS=';' read -r -a preserve_raw_paths <<< "${preserve_entries}" + for preserve_path in "${preserve_raw_paths[@]}"; do + preserve_path="$(echo "${preserve_path}" | xargs)" + preserve_path="${preserve_path#./}" + preserve_path="${preserve_path#/}" + preserve_path="${preserve_path%/}" + if [ -z "${preserve_path}" ]; then + continue + fi + if echo "${preserve_path}" | grep -Eq '(^|/)\.\.(/|$)'; then + fn_script_log_warn "Skipping unsafe preserve path: ${preserve_path}" + continue + fi + if [[ " ${cfmc_preserve_paths[*]} " != *" ${preserve_path} "* ]]; then + cfmc_preserve_paths+=("${preserve_path}") + fi + done +} + +fn_cfmc_backup_preserve() { + local relpath + local srcpath + + fn_cfmc_collect_preserve_paths + cfmc_preserve_dir="${tmpdir}/cfmc-preserve" + rm -rf "${cfmc_preserve_dir}" + mkdir -p "${cfmc_preserve_dir}" + + for relpath in "${cfmc_preserve_paths[@]}"; do + srcpath="${serverfiles}/${relpath}" + if [ -e "${srcpath}" ]; then + mkdir -p "${cfmc_preserve_dir}/$(dirname "${relpath}")" + cp -a "${srcpath}" "${cfmc_preserve_dir}/${relpath}" + fi + done +} + +fn_cfmc_restore_preserve() { + local relpath + local targetpath + local backup_path + + for relpath in "${cfmc_preserve_paths[@]}"; do + targetpath="${serverfiles}/${relpath}" + backup_path="${cfmc_preserve_dir}/${relpath}" + if [ -e "${backup_path}" ]; then + rm -rf "${targetpath}" + mkdir -p "$(dirname "${targetpath}")" + cp -a "${backup_path}" "${targetpath}" + fi + done +} + +fn_cfmc_upsert_setting() { + local setting_name="${1}" + local setting_value="${2}" + local config_file="${configdirserver}/${selfname}.cfg" + local escaped_value + + touch "${config_file}" + escaped_value=$(echo -n "${setting_value}" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/[&|]/\\&/g') + if grep -qE "^[[:blank:]]*${setting_name}=" "${config_file}"; then + sed -i "s|^[[:blank:]]*${setting_name}=.*|${setting_name}=\"${escaped_value}\"|g" "${config_file}" + else + echo "${setting_name}=\"${escaped_value}\"" >> "${config_file}" + fi +} + +fn_cfmc_persist_start_command() { + if [ "${cfmcstartmode}" != "auto" ] || [ -z "${detected_executable}" ]; then + return + fi + + fn_cfmc_upsert_setting "preexecutable" "${detected_preexecutable}" + fn_cfmc_upsert_setting "executable" "${detected_executable}" + fn_cfmc_upsert_setting "startparameters" "${detected_startparameters}" + + preexecutable="${detected_preexecutable}" + executable="${detected_executable}" + startparameters="${detected_startparameters}" +} + +fn_cfmc_detect_start_command() { + local script_name + local jar_name + + detected_preexecutable="" + detected_executable="" + detected_startparameters="" + + if [ "${cfmcstartmode}" != "auto" ]; then + return + fi + + for script_name in startserver.sh start.sh run.sh; do + if [ -f "${serverfiles}/${script_name}" ]; then + chmod +x "${serverfiles}/${script_name}" 2> /dev/null + detected_executable="./${script_name}" + break + fi + done + + if [ -z "${detected_executable}" ]; then + if [ -f "${serverfiles}/server.jar" ]; then + jar_name="server.jar" + elif [ -f "${serverfiles}/minecraft_server.jar" ]; then + jar_name="minecraft_server.jar" + else + jar_name=$(find "${serverfiles}" -maxdepth 1 -type f -name "*.jar" ! -name "*installer*.jar" -printf "%f\n" 2> /dev/null | sort | head -n 1) + fi + + if [ -n "${jar_name}" ]; then + detected_preexecutable="java -Xmx${javaram}M -jar" + detected_executable="./${jar_name}" + detected_startparameters="nogui" + fi + fi + + fn_cfmc_persist_start_command +} + +fn_update_dl() { + local archive_filename="${remotebuildfilename}" + + if [ -n "${localpackpath}" ]; then + cp -f "${localpackpath}" "${tmpdir}/${archive_filename}" + else + fn_fetch_file "${remotebuildurl}" "" "" "" "${tmpdir}" "${archive_filename}" "nochmodx" "norun" "force" "nohash" + fi + + fn_cfmc_backup_preserve + fn_dl_extract "${tmpdir}" "${archive_filename}" "${serverfiles}" + fn_cfmc_restore_preserve + echo "${remotebuildversion}" > "${serverfiles}/build.txt" + fn_cfmc_detect_start_command + fn_clear_tmp +} + +fn_update_localbuild() { + fn_print_dots "Checking local build: ${remotelocation}" + localbuild=$(head -n 1 "${serverfiles}/build.txt" 2> /dev/null) + if [ -z "${localbuild}" ]; then + fn_print_error "Checking local build: ${remotelocation}: missing local build info" + fn_script_log_error "Missing local build info" + fn_script_log_error "Set localbuild to 0" + localbuild="0" + else + fn_print_ok "Checking local build: ${remotelocation}" + fn_script_log_pass "Checking local build" + fi +} + +fn_update_remotebuild() { + fn_cfmc_validate_config + if [ "${cfmcsource}" == "api" ]; then + fn_cfmc_resolve_api_source + else + fn_cfmc_resolve_url_source + fi + fn_cfmc_build_remote_marker + + if [ "${firstcommandname}" != "INSTALL" ]; then + fn_print_dots "Checking remote build: ${remotelocation}" + if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then + fn_print_fail "Checking remote build: ${remotelocation}" + fn_script_log_fail "Checking remote build" + core_exit.sh + else + fn_print_ok "Checking remote build: ${remotelocation}" + fn_script_log_pass "Checking remote build" + fi + else + if [ -z "${remotebuildversion}" ] || [ "${remotebuildversion}" == "null" ]; then + fn_print_failure "Unable to get remote build" + fn_script_log_fail "Unable to get remote build" + core_exit.sh + fi + fi +} + +fn_update_compare() { + fn_print_dots "Checking for update: ${remotelocation}" + if [ "${localbuild}" != "${remotebuildversion}" ] || [ "${forceupdate}" == "1" ]; then + date '+%s' > "${lockdir:?}/update.lock" + fn_print_ok_nl "Checking for update: ${remotelocation}" + echo -en "\n" + echo -e "Update available" + echo -e "* Local build: ${red}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuildversion}${default}" + if [ -f "${rootdir}/.dev-debug" ]; then + echo -e "Remote build info" + echo -e "* remotebuildfilename: ${remotebuildfilename}" + echo -e "* remotebuildurl: ${remotebuildurl}" + echo -e "* remotebuildversion: ${remotebuildversion}" + fi + echo -en "\n" + fn_script_log_info "Update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuildversion}" + fn_script_log_info "${localbuild} > ${remotebuildversion}" + + if [ "${commandname}" == "UPDATE" ]; then + date +%s > "${lockdir}/last-updated.lock" + unset updateonstart + check_status.sh + if [ "${status}" == "0" ]; then + fn_update_dl + if [ "${localbuild}" == "0" ]; then + exitbypass=1 + command_start.sh + fn_firstcommand_reset + exitbypass=1 + fn_sleep_time_5 + command_stop.sh + fn_firstcommand_reset + fi + else + fn_print_restart_warning + exitbypass=1 + command_stop.sh + fn_firstcommand_reset + exitbypass=1 + fn_update_dl + exitbypass=1 + command_start.sh + fn_firstcommand_reset + fi + unset exitbypass + alert="update" + elif [ "${commandname}" == "CHECK-UPDATE" ]; then + alert="check-update" + fi + alert.sh + else + fn_print_ok_nl "Checking for update: ${remotelocation}" + echo -en "\n" + echo -e "No update available" + echo -e "* Local build: ${green}${localbuild}${default}" + echo -e "* Remote build: ${green}${remotebuildversion}${default}" + echo -en "\n" + fn_script_log_info "No update available" + fn_script_log_info "Local build: ${localbuild}" + fn_script_log_info "Remote build: ${remotebuildversion}" + if [ -f "${rootdir}/.dev-debug" ]; then + echo -e "Remote build info" + echo -e "* remotebuildfilename: ${remotebuildfilename}" + echo -e "* remotebuildurl: ${remotebuildurl}" + echo -e "* remotebuildversion: ${remotebuildversion}" + fi + fi +} + +remotelocation="curseforge.com" +resolvedfileid="" +resolvedsource="" +localpackpath="" +cfmc_preserve_dir="" +cfmc_preserve_paths=() + +if [ ! "$(command -v jq 2> /dev/null)" ]; then + fn_print_fail_nl "jq is not installed" + fn_script_log_fail "jq is not installed" + core_exit.sh +fi + +if [ "${firstcommandname}" == "INSTALL" ]; then + fn_update_remotebuild + fn_update_dl +else + fn_print_dots "Checking for update" + fn_print_dots "Checking for update: ${remotelocation}" + fn_script_log_info "Checking for update: ${remotelocation}" + fn_update_localbuild + fn_update_remotebuild + fn_update_compare +fi