Giter Club home page Giter Club logo

mrpack-install's Introduction

mrpack-install

downloads discord go pkg

A cli application for installing Minecraft servers and Modrinth modpacks.


Commands

root

Deploys a Modrinth modpack including Minecraft server.

Usage:
  mrpack-install (<filepath> | <url> | <slug> [<version>] | <id> [<version>]) [flags]
  mrpack-install [command]

Examples:
  mrpack-install https://example.org/data/cool-pack.mrpack
  mrpack-install downloads/cool-pack.mrpack --proxy socks5://127.0.0.1:7890
  mrpack-install adrenaserver --server-file srv.jar
  mrpack-install yK0ISmKn 1.0.0-1.18 --server-dir mcserver
  mrpack-install communitypack9000 --host api.labrinth.example.org
  mrpack-install --version

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  ping        Ping a Labrinth instance
  server      Prepare a plain server environment
  update      Update the deployed modpack
  version     Print version infos

Flags:
      --dl-retries uint8     Retries when download fails (default 3)
      --dl-threads uint8     Concurrent download threads (default 8)
  -h, --help                 help for mrpack-install
      --host string          Labrinth host address (default "api.modrinth.com")
      --proxy string         Proxy url for http connections
      --server-dir string    Server directory path (default "mc")
      --server-file string   Server jar file name
  -v, --verbose              Enable verbose output
  -V, --version              Print version and exit

Use "mrpack-install [command] --help" for more information about a command.

ping

Connect to a Labrinth instance and display basic information.

Usage:
  mrpack-install ping [flags]

Flags:
  -h, --help   help for ping

Global Flags:
      --dl-retries uint8     Retries when download fails (default 3)
      --dl-threads uint8     Concurrent download threads (default 8)
      --host string          Labrinth host address (default "api.modrinth.com")
      --proxy string         Proxy url for http connections
      --server-dir string    Server directory path (default "mc")
      --server-file string   Server jar file name
  -v, --verbose              Enable verbose output

server

Download and configure one of several Minecraft server flavors.

Usage:
  mrpack-install server ( vanilla | fabric | quilt | forge | neoforge | paper ) [flags]

Examples:
  mrpack-install server fabric --server-dir fabric-srv
  mrpack-install server paper --minecraft-version 1.18.2 --server-file srv.jar

Flags:
      --flavor-version string      Flavor version (default "latest")
  -h, --help                       help for server
      --minecraft-version string   Minecraft version (default "latest")

Global Flags:
      --dl-retries uint8     Retries when download fails (default 3)
      --dl-threads uint8     Concurrent download threads (default 8)
      --host string          Labrinth host address (default "api.modrinth.com")
      --proxy string         Proxy url for http connections
      --server-dir string    Server directory path (default "mc")
      --server-file string   Server jar file name
  -v, --verbose              Enable verbose output

update

Update the deployed modpacks files, creating backups if necessary.

Usage:
  mrpack-install update [<version>] [flags]

Flags:
      --backup-dir string   Backup directory path
  -h, --help                help for update

Global Flags:
      --dl-retries uint8     Retries when download fails (default 3)
      --dl-threads uint8     Concurrent download threads (default 8)
      --host string          Labrinth host address (default "api.modrinth.com")
      --proxy string         Proxy url for http connections
      --server-dir string    Server directory path (default "mc")
      --server-file string   Server jar file name
  -v, --verbose              Enable verbose output

version

Extract and display the running binaries embedded version information.

Usage:
  mrpack-install version [flags]

Flags:
  -h, --help   help for version

Global Flags:
      --dl-retries uint8     Retries when download fails (default 3)
      --dl-threads uint8     Concurrent download threads (default 8)
      --host string          Labrinth host address (default "api.modrinth.com")
      --proxy string         Proxy url for http connections
      --server-dir string    Server directory path (default "mc")
      --server-file string   Server jar file name
  -v, --verbose              Enable verbose output

Build

To build binaries, run:

goreleaser build --clean --snapshot

Release

To build a local snapshot release, run:

goreleaser release --clean --snapshot

To build and publish a full release, push a semver tag (with 'v' prefix) to the 'main' branch on GitHub.

mrpack-install's People

Contributors

anhgelus avatar chikage0o0 avatar dependabot[bot] avatar mmtawous avatar nothub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mrpack-install's Issues

Large modpacks trigger a SIGABRT

Currently, large modpacks such as the Versatile v7.5 pack triggers a SIGABRT caused by the following

runtime/cgo: pthread_create failed: Resource temporarily unavailable

This is caused by the value in the --dl-threads flag not being used in the Downloader. Here is a snippet of the relevant code from main.

type Downloader struct {
Downloads []*Download
Threads int // TODO
Retries int
}
func (g *Downloader) Download(baseDir string) {
var wg sync.WaitGroup
for i := range g.Downloads {
wg.Add(1)
dl := g.Downloads[i]
go func() {
defer wg.Done()
absPath, _ := filepath.Abs(filepath.Join(baseDir, dl.Path))
success := false
for _, link := range dl.Urls {
// retry when download failed
for retries := 0; retries < g.Retries; retries++ {
// try download

File support for update command

I use local packs for my server since i distribute mods with automodpack rather than by having people download the pack manually. I have a script that runs mrpack-install latest-pack.mrpack on every restart, and this worked until i replaced a mod with a mutually incompatible one. it was at this point i realized that the program only deletes files when running update, and that the update command has no code path for files. Could this capability be added?

URL argument buggy on windows

Reported on Discord:

PS C:\Users\User\AppData\Roaming\Minecrat_Servers\CFC> mrpack-install "https://cdn.modrinth.com/data/zj6Ob29g/versions/tt6mZDVe/Chronicles%20From%20Creation%201.0.1.mrpack"
2023/10/30 22:56:58 CreateFile https://cdn.modrinth.com/data/zj6Ob29g/versions/tt6mZDVe/Chronicles%20From%20Creation%201.0.1.mrpack: The filename, directory name, or volume label syntax is incorrect.

mrpack spec does not define path separators

I wanted to install a pack with mrpack-install on a raspberrypi, but sadly the downloaded mods are named mods\modname.jar in are located in the server's root directory not in the mods one. I think this occures because mrpack-install isn't noticing that it is running in a linux enviroment and uses \ instead of / so the files are named instead of beeing moved.

Automatically filter client-side mods

In order not to have client-side mods, such as Embeddium, Rubidium, JEI, REI, etc...
Mods have a data on the Modrinth API that tells if the mod is client-side, server-side or both

Add way of handling optional mods

Currently there is no automatically way with the installer to handle optional mods (that I can find in the help options). There should be an interactive (select the optional mods you want installed) and an automatic (command line options that disable all, enable all, or enable select mods) way of managing optional mods upon installation.

Update command

  • Finalize concept for update behaviour
  • Review packstate.json schema and implementation.
  • Review implementation of update command
  • Write tests with realistic test-scenarios
Some old notes ---

Updating an existing modpack

Behaviour

TODO: use clear terminology

  • packstate
  • old packstate
  • new packstate
  • packstate files/hashes

For an updated to be executed, the program performs the following steps:

  1. Read state information of old modpack version from packstate.json file.
    • Download the mrpack archive of the new modpack version if required.
  2. Generate state information of new modpack version from mrpack archive file.
  3. If any version difference of dependencies exists, cancel the update.
    • (minecraft, fabric-loader, quilt-loader, forge, neoforge)
    • TODO: flag for continuing anyway
    • TODO: actually also keep track of and update the dependencies
  4. For all files not changed by the update:
    • If the file is stored inside the mods directory and
    • the file is present in the old modpack version and
    • the file is not present in the new modpack version, then
    • create a backup of the file and delete the file.
  5. For all files changed by the update:
    • If the file is not stored inside the mods directory and
    • the file hash is not equal to the hash in the old modpack version and
    • the file hash is not equal to the hash in the new modpack version, then
    • create a backup of the file and overwrite the file.

TODO: is this actually a sane behaviour for updates? mock some scenarios
TODO: correctly implemented the planned behaviour and write tests

packstate.json

To keep track of changes, mrpack-install creates a packstate.json file to store information about the state of a
modpack installation.

Example

{
  "slug": "my-cool-pack",
  "project-id": "TDM2I9Mu",
  "version": "1.3.2",
  "version-id": "TpN85eu2",
  "dependencies": {
    "minecraft": "1.19.2",
    "fabric-loader": "0.14.10"
  },
  "hashes": {
    "INFOS.txt": {
      "sha1": "8548257fd702d58e02bd58f6bcc8affbb96a5d38",
      "sha512": "cf83e1357eefb8bdf1542850d66d8007d621e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec3f63b931bd47417a81a538327af927da3e"
    },
    "mods/ultra-blocks-1.2.3+mc1.19.2.jar": {
      "sha1": "df8e2fbabdbeea9c5acea5b1178ad3bb3d75fcf7",
      "sha512": "9884fcf6e1f10c1a6e85fd41515bc2e05390c160dd9c70844d1814a0085dd42c850129b5bf175f6d89ca40b86fbe6407dc3b9a48fb8f393fbd68eafa3b9c5b8c"
    }
  }
}

Can this also install mods to the client?

I noticed this tool creates a server folder and installs mods for the server. If I just copy the generated mods folder to my local game's Minecraft folder, will my local game have all the mods from the modpack?

-v / --verbose No longer in help and no longer works

I am trying to use this to update a pack I've been managing with it and there is a 404 for one of the mods or mod updates. Problem is, this is all I get:

mc@mineos_server:~/servers/CobblemonPlus$ /var/games/minecraft/util/mrpack-install-linux install 'Cobblemon Fabric Plus 1.4.1-plus-1.0.5.mrpack' --server-dir "${PWD}"
2024/05/17 18:50:20 http status 404

I can't tell what the mod or file is thats throwing a 404, and so i can't fix it. This is where the verbose mode mentioned in the repo docs would be needed, however in the most recent version, verbose is no longer an option:

mc@mineos_server:~/servers/CobblemonPlus$ /var/games/minecraft/util/mrpack-install-linux --version                                                                                     
mrpack-install v0.16.10
mc@mineos_server:~/servers/CobblemonPlus$ /var/games/minecraft/util/mrpack-install-linux --help   
Deploys a Modrinth modpack including Minecraft server.

Usage:
  mrpack-install (<filepath> | <url> | <slug> [<version>] | <id> [<version>]) [flags]
  mrpack-install [command]

Examples:
  mrpack-install https://example.org/data/cool-pack.mrpack
  mrpack-install downloads/cool-pack.mrpack --proxy socks5://127.0.0.1:7890
  mrpack-install hexmc-modpack --server-file server.jar
  mrpack-install yK0ISmKn 1.0.0-1.18 --server-dir mcserver
  mrpack-install communitypack9000 --host api.labrinth.example.org
  mrpack-install --version

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  ping        Ping a Labrinth instance
  server      Prepare a plain server environment
  update      Update the deployed modpack
  version     Print version infos

Flags:
      --download-threads int   Download threads (default 8)
  -h, --help                   help for mrpack-install
      --host string            Labrinth host (default "api.modrinth.com")
      --proxy string           Use a proxy to download
      --retry-times int        Number of retries when a download fails (default 3)
      --server-dir string      Server directory path (default "mc")
      --server-file string     Server jar file name
  -V, --version                Print version and exit

Use "mrpack-install [command] --help" for more information about a command.
mc@mineos_server:~/servers/CobblemonPlus$ /var/games/minecraft/util/mrpack-install-linux install 'Cobblemon Fabric Plus 1.4.1-plus-1.0.5.mrpack' --server-dir "${PWD}" --verbose       
Error: unknown flag: --verbose
Usage:
  mrpack-install (<filepath> | <url> | <slug> [<version>] | <id> [<version>]) [flags]
  mrpack-install [command]

Examples:
  mrpack-install https://example.org/data/cool-pack.mrpack
  mrpack-install downloads/cool-pack.mrpack --proxy socks5://127.0.0.1:7890
  mrpack-install hexmc-modpack --server-file server.jar
  mrpack-install yK0ISmKn 1.0.0-1.18 --server-dir mcserver
  mrpack-install communitypack9000 --host api.labrinth.example.org
  mrpack-install --version

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  ping        Ping a Labrinth instance
  server      Prepare a plain server environment
  update      Update the deployed modpack
  version     Print version infos

Flags:
      --download-threads int   Download threads (default 8)
  -h, --help                   help for mrpack-install
      --host string            Labrinth host (default "api.modrinth.com")
      --proxy string           Use a proxy to download
      --retry-times int        Number of retries when a download fails (default 3)
      --server-dir string      Server directory path (default "mc")
      --server-file string     Server jar file name
  -V, --version                Print version and exit

Use "mrpack-install [command] --help" for more information about a command.

Unsure if this was mistakenly removed or intentionally removed, but we need to be able to have more info than 2024/05/17 18:50:20 http status 404 to diagnose issues with packs.

FWIW - ATLauncher can install this version update with no errors, no 404s occur.

CreateFile error when passing URL argument on Windows

Reported on Discord:

C:\Foo>mrpack-install-windows.exe https://cdn.modrinth.com/data/1KVo5zza/versions/GYZXXw4w/Fabulously.Optimized-5.4.0-alpha.4.mrpack
2023/09/30 19:04:59 CreateFile https://cdn.modrinth.com/data/1KVo5zza/versions/GYZXXw4w/Fabulously.Optimized-5.4.0-alpha.4.mrpack: The filename, directory name, or volume label syntax is incorrect.

How to install and use

Hello, I came across this from the modrinth website. I am relatively new to linux and cannot figure out the proper command to run the install file for mrpack-install. If someone could guide me the right way that would be awesome. Sorry about the fact this probably isn't the best place to post this.

Overrides fail on local modpack

I have a modpack that my friend made, and when I try to create a server using this tool the overrides fail to extract.

Running this command:
Screenshot from 2024-03-03 17-28-13
Results in this:
Screenshot from 2024-03-03 17-28-32

Not a huge issue as the overrides can be extracted manually, but would be awesome if It can be addressed.
Cheers! Awesome tool btw!

"File path is not safe"

v0.17.2-beta

c:\MCServers>mrpack-install "c:\MCServers\mrpacks\Prominence II [RPG] 2.8.4.mrpack" Installing "Prominence II [RPG]" from "c:\\MCServers\\mrpacks\\Prominence II [RPG] 2.8.4.mrpack" to "c:\\MCServers\\mc" File path is not safe: c:\MCServers\mc\mods\do-a-barrel-roll-3.3.7+1.20-fabric.jar

Nothing is created at all so it seems to be failing in the first step

Quilt install not working

When installing a pack with Quilt, the command java -jar quilt-installer-latest.jar ... has an exit code to 1 : the jar file is corrupted.

After looking in the code, the link to download the quilt universal installer is not working (error 404).

To fix this, I think we must just change the https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-installer/latest/quilt-installer-latest.jar to https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-installer/0.5.0/quilt-installer-0.5.0.jar.

I'll do a PR to fix this.

Server starter / Pack updates

For practical use, would it not be more convenient to integrate the start-server directly into the program。It will allow you to run on more systems

How do I install forge?

I've ran the forge installer with --installServer in my server dir (cl5)

If I run this command:

mrpack-install https://cdn.modrinth.com/data/VUmd23oG/versions/OB9wIUXt/Create%20Live%205%201.0.0.mrpack --server-dir cl5 --server-file cl5/libraries/net/minecraftforge/forge/1.20.1-47.2.0/forge-1.20.1-47.2.0-server.jar

I still get this:

Downloading mrpack file from [https://cdn.modrinth.com/data/VUmd23oG/versions/OB9wIUXt/Create%20Live%205%201.0.0.mrpack]
Processing mrpack file cl5/Create Live 5 1.0.0.mrpack
Installing: Create Live 5
Flavor dependencies: {Minecraft:1.20.1 Fabric: Quilt: Forge:47.2.17}
Server file not present, downloading...
(Point --server-dir and --server-file flags to an existing server file to skip this step.)
Please acquire the required forge server file (47.2.17) manually to continue: https://files.minecraftforge.net/net/minecraftforge/forge/index_1.20.1.html
2024/04/05 09:38:10 forge provider not implemented

More docs

Documentation is little and flawed.

  • Install guide
  • Usage guide (TLDR style)

How to create a modrinth server.

Ok. I want to create a server for this modpack: https://modrinth.com/modpack/the-amazing-world-of-buddy/changelog

I run:
mrpack-install JK8HDnay

It creates a .mrpack in ~/mc directory but it doesn't give me anywhere as to the location of the server itself

~$ mrpack-install JK8HDnay
Downloading mrpack file from https://cdn.modrinth.com/data/JK8HDnay/versions/t65SnhrN/The%20Amazing%20World%20of%20Buddy%203.1.0.mrpack
Processing mrpack file mc/The Amazing World of Buddy 3.1.0.mrpack
Installing: The Amazing World of Buddy
Flavor dependencies: {Minecraft:1.20.1 Fabric: Quilt: Forge:47.2.17}
Server file not present, downloading...
(Point --server-dir and --server-file flags to an existing server file to skip this step.)
Please acquire the required forge server file (47.2.17) manually to continue: https://files.minecraftforge.net/net/minecraftforge/forge/index_1.20.1.html
2024/05/16 18:14:30 forge provider not implemented

Why does it create a .mrpack file when all I ask is server files? Like how can I go on forge and it has a .zip of server files for pretty much all modpacks, but that's not possible with mrpack-install?

Is there a way to actually get the files for this so that all I have to do is cd into the minecraft server directory and do ./run.sh?

Download Cache

Local cache for downloads with lookup based on some file hashing algo.

Use xdg for path lookup.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.