Skip to content

Updated mods updater script to correctly process mod releases #557

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jul 3, 2025

Conversation

Victor9401
Copy link

The script should correctly process mod releases

The updated script goes through each version reverse sorted by release date, then performs some checks.
If the check fails, it continues to the next release until the correct release found. The logic is the same for the case, if no release was found.

First, it checks Factorio version vs mod Factorio version.

If Major version differs, it skips it.
If Minor version is less, also skips.

Then it goes through the optional dependencies element and checks it with game version, for base dependencies.
If the dependency rule is false, it skips it.

Checked script on my own modpack, and the jetpack mod was downgraded to the correct version for 2.0.21, everything else updated correctly. DLC mods also were ignored because they are for version 1.1


Disclaimer:

I am not proficient with bash scripting, so I made the changes with the help of ChatGPT.
Also, I haven't added any advanced logic to the main mod Factiorio version check.

So the updater won't correctly update mods for this case, leaving old versions:

Mods with the factorio_version "0.18" can also be loaded in 1.0 and the mod portal will return them when queried for factorio_version 1.0 mods.

Copy link
Member

@fank fank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this improvement! The enhanced version compatibility checking and dependency resolution logic look solid.

✅ Key improvements:

  • Proper major/minor version comparison instead of simple string matching
  • Checks optional dependencies (especially base) to ensure compatibility
  • Processes releases chronologically to find the best compatible version
  • Better error handling that doesn't stop processing all mods on single failure

✅ Code quality:

  • Input validation is properly handled
  • No security issues found (no command injection risks)
  • Safe file operations maintained

The limitation mentioned about cross-major version compatibility (0.18 → 1.0) is reasonable and well-documented.

LGTM! 🚀

@fank fank merged commit 9464758 into factoriotools:master Jul 3, 2025
@serjevski
Copy link

Unfortunately, the check still doesn't work perfectly.
There is a mod: https://mods.factorio.com/mod/manual-inventory-sort/changelog — the author uploaded version 2.3.0 for Factorio 2.0, and then uploaded version 11.3.0, which is only compatible with Factorio 1.1.

However, with auto-updates enabled, the container downloads version 11.3.0 for Factorio 2.0.

It would be great if this could be fixed, if possible.

@fank
Copy link
Member

fank commented Jul 16, 2025

@serjevski coulkd you please share the logs, of what is happening.
I need the logs to understand the issue of what exactly is happening.

@Victor9401
Copy link
Author

Just tried running the update with this modlist file

{
  "mods": [
    {
      "name": "base",
      "enabled": true
    },
    {
      "name": "manual-inventory-sort",
      "enabled": true
    }
  ]
}

Logs are

Checking for update of mod manual-inventory-sort for factorio 2.0.60 ...
  Skipping mod version 11.3.0 because of factorio version mismatch
  Downloading manual-inventory-sort_2.3.0.zip
  Download complete.

File downloaded is manual-inventory-sort_2.3.0.zip

I am kindly asking you to do docker compose pull before starting the container. If it still does not work, then please comment.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants