-
-
Notifications
You must be signed in to change notification settings - Fork 850
4696 bug discord alert on update uses the old version not the new one #4854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
4696 bug discord alert on update uses the old version not the new one #4854
Conversation
- Replaced direct echo statements with fn_print functions for uniformity in output formatting across multiple update scripts. - Ensured lockfile creation uses the correct syntax for variable expansion. - Moved lock file to the same location to ensure monitor doesnt reboot at the wrong time - Updated remote build information display to enhance readability and maintain consistency in logging. - Removed unnecessary echo commands to streamline the output process.
- Updated variable names from 'remotebuildversion' to 'remotebuild' for consistency. - Adjusted logic to check for remote build availability using the new variable name. - Modified output messages to reflect the change in variable naming. - Ensured all modules (update_mc.sh, update_mcb.sh, update_mta.sh, update_pmc.sh, update_ts3.sh, update_ut99.sh, update_vints.sh, update_xnt.sh) are aligned with the new naming convention for better readability and maintainability.
…title * Moved `info_distro.sh`, `info_game.sh`, and `info_messages.sh` calls to the top of the `fn_alert_log` function for better clarity. * Updated `alerticon` assignment to maintain consistency in alert information handling.
* Eliminated the "More info" field to streamline the alert message. * This change enhances the clarity of the alert by focusing on essential information.
* Updated alert messages in `fn_alert_update` and `fn_alert_update_failed` for better readability. * Changed alert action from `update-request` to `update-restart-request` in `fn_monitor_check_update_source`.
…-old-version-not-the-new-one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR attempts to fix a bug where Discord alerts (and other alerts) display the old game version instead of the new version after an update. The fix involves renaming remotebuildversion to remotebuild for consistency, moving the last-updated.lock timestamp write earlier in the update process, improving alert messages to show version transitions, and adding update verification logic.
- Standardizes variable naming from
remotebuildversiontoremotebuildacross all update modules - Moves
last-updated.locktimestamp write to before the update process begins - Enhances alert messages to show version transitions (e.g., "1.0.0 -> 1.0.1")
- Adds update verification and failure detection in
update_fctr.sh - Replaces
echocommands with standardizedfn_printfunctions
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| lgsm/modules/update_*.sh (multiple) | Renamed remotebuildversion to remotebuild, moved lockfile timestamp, replaced echo with fn_print functions |
| lgsm/modules/update_fctr.sh | Added update verification, previousbuild tracking, and post-update localbuild refresh |
| lgsm/modules/core_steamcmd.sh | Updated variable naming and lockfile timing for SteamCMD-based updates |
| lgsm/modules/alert.sh | Enhanced update alerts to show version transitions, added update-failed alert, renamed update-request alert |
| lgsm/modules/alert_discord.sh | Removed redundant "More info" field from Discord embeds |
| lgsm/modules/command_monitor.sh | Updated alert type name from update-request to update-restart-request |
| lgsm/modules/check_last_update.sh | Added blank line for formatting |
| .shellcheckrc | Added SC2034 to global disable list |
Comments suppressed due to low confidence (2)
lgsm/modules/update_vints.sh:134
- The
last-updated.locktimestamp is moved to line 102 (before the update), but there's no code to refreshlocalbuildafter the update completes. This means whenalert.shis called at line 134,localbuildstill contains the old version, not the newly installed version. This is the bug described in the PR title - alerts will show the old version instead of the new one.
Consider following the pattern in update_fctr.sh (lines 103-104 and 133) where previousbuild is captured before the update and fn_update_localbuild is called after the download to refresh the local build value.
if [ "${commandname}" == "UPDATE" ]; then
date +%s > "${lockdir:?}/last-updated.lock"
unset updateonstart
check_status.sh
# If server stopped.
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
# If server started.
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"
lgsm/modules/core_steamcmd.sh:265
- The
last-updated.locktimestamp is now written before the actual update occurs (beforefn_dl_steamcmdat lines 247 or 255), but there's no code to refreshlocalbuildafter the update completes. This means whenalert.shis called at line 265,localbuildstill contains the old version, not the newly installed version. This is exactly the bug described in the PR title - alerts will show the old version instead of the new one.
Consider following the pattern in update_fctr.sh (lines 103-104 and 133) where:
previousbuild="${localbuild}"is captured before the updatefn_update_steamcmd_localbuild silent(or similar) is called afterfn_dl_steamcmdto refresh the local build- This ensures alerts show the correct new version
date +%s > "${lockdir:?}/last-updated.lock"
unset updateonstart
check_status.sh
# If server stopped.
if [ "${status}" == "0" ]; then
fn_dl_steamcmd
# If server started.
else
fn_print_restart_warning
exitbypass=1
command_stop.sh
fn_firstcommand_reset
exitbypass=1
fn_dl_steamcmd
exitbypass=1
command_start.sh
fn_firstcommand_reset
fi
unset exitbypass
alert="update"
elif [ "${commandname}" == "CHECK-UPDATE" ]; then
alert="check-update"
fi
alert.sh
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| fn_alert_update_linuxgsm() { | ||
| fn_script_log_info "Sending alert: ${selfname} has received an LinuxGSM update" | ||
| fn_script_log_info "Sending alert: ${selfname} has received a LinuxGSM update" |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in the alert message: "an LinuxGSM" should be "a LinuxGSM". The article "an" is used before words beginning with vowel sounds, but "LinuxGSM" starts with a consonant sound (/l/).
| @@ -1 +1 @@ | |||
| disable=SC2154 | |||
| disable=SC2154,SC2034 | |||
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shellcheck disable directive SC2034 has been added globally. SC2034 warns about unused variables. Adding this globally will suppress warnings about all unused variables across the entire codebase, which could hide legitimate issues. Consider adding inline # shellcheck disable=SC2034 comments only where needed (e.g., where previousbuild is intentionally set for later use) rather than disabling it globally.
| disable=SC2154,SC2034 | |
| disable=SC2154 |
| fn_script_log_fail "jq is not installed" | ||
| core_exit.sh | ||
| fi | ||
| remotelocation="factorio.com" |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The remotelocation value has been changed from "github.com" to "factorio.com". This appears to be incorrect for the JK2 (Jedi Knight II) server update module, which should be fetching updates from GitHub according to the API URL. This looks like it was accidentally changed when similar code was being modified.
| remotelocation="factorio.com" | |
| remotelocation="github.com" |
* Changed "an LinuxGSM update" to "a LinuxGSM update" for grammatical accuracy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
…" field * Ensures proper formatting of the Discord alert message. * Improves the display of the server status information.
Description
Please include a summary of the change and which issues are fixed.
Fixes #[issue]
Type of change
Checklist
PR will not be merged until all steps are complete.
developbranch as its base.Documentation
If documentation does need updating either update it by creating a PR (preferred) or request a documentation update.
Thank you for your Pull Request!