Created attachment 246870 [details] Update from 1.20.2 to 1.20.3 and improvements for cleaning during uninstall Update from 1.20.2 to 1.20.3 This patch updates games/minecraft-server to 1.20.3 Master URL found on official website https://www.minecraft.net/en-us/download/server Full changelog available on official website https://www.minecraft.net/en-us/article/minecraft-java-edition-1-20-3 As discussed for previous version with vvd@ https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274534 I made improvements for files deletion directly downloaded by the app itself. /usr/local/minecraft-server is removed when port is uninstalled. I added "@postunexec rm -rf %D/minecraft-server" and removed each "@rmtry" in pkg-plist and I also removed folders deletion (minecraft-server/libraries and minecraft-server/versions) in pkg-deinstall.in This way only one command in one file replace many commands in two files. This is a proposal and I can keep the previous way if you are disagree with it.
Created attachment 246899 [details] Update from 1.20.2 to 1.20.4 and improvements for cleaning during uninstall Mojang Studio released a new version of Minecraft Server since 1.20.3 update proposal. I kept the same approach than the one suggested yesterday for 1.20.3. Minecraft 1.20.4 is a hotfix release for Java Edition which fixes a critical bug that could cause items to vanish after being stored in a Decorated Pot. Minecraft Java Edition 1.20.4 changelog is available on the official website https://www.minecraft.net/en-us/article/minecraft-java-edition-1-20-4
(In reply to Alexandre Labarre from comment #1) Nuking /usr/local/minecraft-server directory altogether is dangerous, when the port never made it clear that the directory is ephemeral and anything added there could be gone at uninstall time. I can imagine people storing mods and other files that should persist across upgrades, in that directory.
What about: @postunexec rm -rf %D/minecraft-server/libraries %D/minecraft-server/versions ?
Created attachment 247289 [details] Update from 1.20.2 to 1.20.4 and improvements for cleaning during uninstall Thank you Eugene for your reply. I hope the following correction will match what you expect. As proposed by vvd@ I modified pkg-plist with these lines (I removed previous @postunexec rm -rf %D/minecraft-server) +@postunexec rm -rf %D/minecraft-server/libraries +@postunexec rm -rf %D/minecraft-server/versions
(In reply to Eugene M. Kim from comment #2) > storing mods What is exact path for storing mods?
(In reply to Alexandre Labarre from comment #4) LGFM, but: 1) waiting maintainer approval; 2) I want to test on my installation before commit.
Forgot: why do you change MASTER_SITES: -MASTER_SITES= https://launcher.mojang.com/v1/objects/5b868151bd02b41319f54c8d4061b8cae84e665c/ +MASTER_SITES= https://piston-data.mojang.com/v1/objects/8dd1a28015f51b1803213892b50b7b4fc76e594d/ https://launcher.mojang.com/v1/objects/8dd1a28015f51b1803213892b50b7b4fc76e594d/server.jar work too.
(In reply to Vladimir Druzenko from comment #7) On official website https://www.minecraft.net/en-us/download/server this is the URL returned when I click on the link to download JAR file. Do you get the same mirror server on you side? Maybe the link change because of geolocation?
(In reply to Vladimir Druzenko from comment #5) Eugene will confirm or not as I don’t use any mod. But if I am not wrong, you must use a specific version like Forge. This port is the official Minecraft version, and AFAIK it seems impossible to install a server side mod.
(In reply to Alexandre Labarre from comment #8) I got the same URL - "piston-data", but I think the maintainer should have his say. (In reply to Alexandre Labarre from comment #9) > AFAIK it seems impossible to install a server side mod. I don't know much about server side mods…
Specifically cleaning /libraries and /versions works for me. Most of the extra files are outside those two. In particular, server-side plugins go into the /plugins directory. I guess, though, that it won't hurt to slap a short README in /usr/local/minecraft-server to note that /libraries and /versions are ephemeral and anything manually placed there will be gone at uninstall time.
BTW, since /libraries and /versions are extracted from server.jar (inside META-INF directory), the following shell one-liner would work to remove only those files and directories when run from /usr/local/minecraft-server, while leaving : bsdtar tf server.jar | sed -En 's@^META-INF/(libraries|versions)/@\1/@p' | sort -r | tr '\n' '\0' | xargs -0 rm -d (Yep, abusing the facts that 1) the libarchive-backed bsdtar handles .zip/.jar archives and that 2) rm -d handles both files and directories uniformly. :-p) This works on my server: root@chips:/usr/local/minecraft-server # mkdir s root@chips:/usr/local/minecraft-server # cp -Rp server.jar libraries versions s/ root@chips:/usr/local/minecraft-server # cd s root@chips:/usr/local/minecraft-server/s # touch libraries/omg versions/1.20.4/wtf bbq root@chips:/usr/local/minecraft-server/s # tar tf server.jar | sed -En 's@^META-INF/(libraries|versions)/@\1/@p' | sort -r | tr \\n \\0 | xargs -0 rm -d rm: versions/1.20.4/: Directory not empty rm: versions/: Directory not empty rm: libraries/: Directory not empty root@chips:/usr/local/minecraft-server/s # find . . ./versions ./versions/1.20.4 ./versions/1.20.4/wtf ./server.jar ./libraries ./libraries/omg ./bbq
(In reply to Eugene M. Kim from comment #12) > while leaving : while leaving other locally introduced files/directories intact (see the omg/wtf/bbq files)
(In reply to Vladimir Druzenko from comment #10) Apologies for the huge delay in reviewing this patch, been super busy training to fly the 737! I am happy with the proposed URL for fetching the new version. It matches what I see when I try to fetch it from the website. I will try to review the change in behaviour to the libraries and versions folder in the next 1-2 days, but given that the existing behaviour is already to delete the entire folders, I suspect it's fine.
(In reply to Jonathan Price from comment #14) > given that the existing behaviour is already to delete the entire folders, I suspect it's fine. The current behavior is NOT to delete the entire folders; it surgically deletes specific files one by one (@rmtry), then selectively removes empty directories, leaf-/depth-first (the two "find" commands in the deinstall script – they do not nuke the entire hierarchies). If there are any other things than empty directories, the current method keeps them intact. (P.S. 737! I envy you +_+)
Despite the fact that I previously proposed the option of deleting the entire directory, I now believe that the original option is more correct, although more difficult to maintain: when updating, files not related to port will not be accidentally deleted.
Created attachment 248739 [details] Patch to 1.20.4 - maintaining existing strategy for cleaning on uninstall. See comments Once again, apologies for the delay on this, but my outside work has finally slowed down for a bit. I have decided to create a patch keeping the existing process for finding and removing files on uninstallation. Do not take this to mean that I don't welcome future suggestions / patches for alternative methods though! Thank you to all that have contributed in this discussion. I have tested this for both the daemon and standalone config options and it appears to be behaving as intended for both, but feel free to also complete your own testing.
(In reply to Jonathan Price from comment #17) Thank you Johnathan! I understand your comment: it's OK for me :-) It works fine on 14.0-RELEASE amd64. I tried things with @preunexec to detect files downloaded by JAR itself before server.jar deletion (with the command suggested by Eugene: thank you for your tip), but without success.
ok, I'll commit it soon (I hope :-D).
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=6b5a47c1f9f1b6b49654bf9903538fcec9e8b56b commit 6b5a47c1f9f1b6b49654bf9903538fcec9e8b56b Author: Alexandre Labarre <freebsd.tug890@passmail.net> AuthorDate: 2024-03-24 18:39:15 +0000 Commit: Vladimir Druzenko <vvd@FreeBSD.org> CommitDate: 2024-03-24 18:39:15 +0000 games/minecraft-server: Update to 1.20.4 Changelog: https://www.minecraft.net/en-us/article/minecraft-java-edition-1-20-3 https://www.minecraft.net/en-us/article/minecraft-java-edition-1-20-4 PR: 275606 Approved by: arrowd (mentor, implicit) games/minecraft-server/Makefile | 4 ++-- games/minecraft-server/distinfo | 6 +++--- games/minecraft-server/pkg-plist | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-)
Committed, thanks!
Oh, indicated the author Alexandre Labarre… Is it ok?