Synology-Install-Package-for-Minecraft-and-Craftbukkit icon indicating copy to clipboard operation
Synology-Install-Package-for-Minecraft-and-Craftbukkit copied to clipboard

Request: Auto update Minecraft

Open avluis opened this issue 9 years ago • 7 comments

I don't currently have the time (busy with upgrading an Android app) for this, but I thought I would share this process:

If you query the following JSON file, you'll get the file that the Minecraft launcher makes use of for updating. You'll need to do a bit of JSON parsing in order to grab the key release which is followed by the current release value - currently: 1.9.2.

Once you have that on your hands, you can then construct the following URL: "https://s3.amazonaws.com/Minecraft.Download/versions/" + [release] + "/minecraft_server." + [release] + ".jar"

So the current release: https://s3.amazonaws.com/Minecraft.Download/versions/1.9.2/minecraft_server.1.9.2.jar

Notes: To parse the json, you can use jsawk, but I believe that requires a JavaScript interpreter - I haven't looked into the Synology dev tools, but maybe they provide something along these lines, if not: awk is included in Linux installs and in DSM, I'll have to take some time to build the right arguments for you, but I'll update this when I do.

avluis avatar May 07 '16 23:05 avluis

Interesting. Of course, a new SPK would still need to be published each time to force an update, but it would save a small amount of editing and potential errors.

colin1497 avatar May 17 '16 19:05 colin1497

Yep - pretty much the same train of thought :+1:

Edit: What if your application includes a small 'utility' to update dependency files, those being the minecraft server jar, etc. I was thinking a cron job at first, but you can't predict updates like that so maybe having a manual step in there, where the user knows there is an update would do. SPKs can still be released alongside this for those that don't care for said utility or manual updates.

avluis avatar May 17 '16 19:05 avluis

I at least created a little "make" batch file that let me build the SPK quickly after I manually update the text file. It's still a bit clunky and obviously requires interaction from me, but it's better than manually doing everything like I was for a while.

Thinking out loud, I guess ideally there would be a cron job that would check for new versions and let me know, and my make file that I would manually execute would fill everything in via tokens so that executing it would automagically increment the build number and build with the latest version.

colin1497 avatar May 21 '16 16:05 colin1497

Well - you could actually take it a step further, depending on your build environment, and have that cron job actually run the makefile whenever a new release is out. I have been getting more time in my hands lately so I'll be able to set up a build environment on my development system soon enough, just need to read the documentation from Synology on how to go about that.

Care to share how yours is setup for building packages? The last thing I did in regards to DSM was building kernel packages.

avluis avatar May 21 '16 20:05 avluis

There's really not much to it. Basically you're just creating a tarball that has all the scripts in it. I think if you grab what I've got you'll realize how trivial this all is.

colin1497 avatar May 21 '16 20:05 colin1497

Awesome, good to know - I'll grab and create a PR when I have something substantial to compare.

avluis avatar May 21 '16 21:05 avluis

Now when the server version was bumped again, @avluis. Did you make an attempt on this?

I was thinking that the version of the server wrapper package do not necessarily have to match the one of the server. So if this wrapper could always download the server binary on run instead of install, there would be no need for any hands on unless the location of the latest server binary changes.

Edit: Possibly using a script from https://github.com/M-D-M/LinuxMinecraftTools to get the latest server binary

devsnail avatar Jul 22 '18 17:07 devsnail