Skip to content
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

Update SetupMinecraft.sh #42

Merged
merged 1 commit into from
Aug 2, 2022
Merged

Update SetupMinecraft.sh #42

merged 1 commit into from
Aug 2, 2022

Conversation

zqigolden
Copy link
Contributor

Fix a bug to download the correct arm JRE.

fix a bug when downloading jre.
@zqigolden
Copy link
Contributor Author

However, there are still some bugs. The JRE downloaded by the script is broken in my raspberry pi while the JRE I download from the link manually work perfectly.

@TheRemote TheRemote merged commit e1acb31 into TheRemote:master Aug 2, 2022
@TheRemote
Copy link
Owner

TheRemote commented Aug 2, 2022

Hey zqigolden,

Thanks for fixing the link! I thought of a way that should fix your problem as well as the problem of people having outdated JREs.

Basically now it checks like this:

  # Check currently installed OpenJDK
  if [ -e "$DirName/minecraft/jre/bin/java" ]; then
    CurrentJava=$($DirName/minecraft/jre/bin/java -version 2>&1 | head -1 | cut -d '"' -f 2 | cut -d '.' -f 1)
    if [[ $CurrentJava -lt 18 ]]; then
      echo "Older or broken Java installation found -- reinstalling..."
      rm -rf "$DirName/minecraft/jre"
    fi
  fi

  # Install Java
  Print_Style "Installing OpenJDK..." "$YELLOW"

This check before Java is installed basically tests it to see if it returns less than OpenJDK 18 (it should return nothing which would be less than 18 when it's broken) it will completely remove the jre folder and pretend like it never existed. If they have an older working OpenJDK install it will remove it and upgrade them to 18 without them having to fight with the folder itself anymore.

Can you try installing with the latest one and see if it can fix that broken jre install? If you've already manually fixed it then that is fine as it should be addressed here!

@zqigolden
Copy link
Contributor Author

Hi, I tried to install the new version again from scratch. And everything worked without any issues!

The other bug I mentioned is because of the "AllowLocalCopy" variable (I didn't notice that when debugging locally). You can just ignore that.

@TheRemote
Copy link
Owner

TheRemote commented Aug 3, 2022

No worries at all, I'm glad you were able to navigate through them well enough!

I actually ended up making this even more robust and have it remove and reinstall the jre folder each time SetupMinecraft.sh is ran.

This was with the idea that generally people will run it on Minecraft version updates and that gives a chance to keep the jre up to date so they aren't exposed to security vulnerabilities from ancient JRE binaries and will generally keep them updated and safe.

This change will also just wipe out anything weird that might happen during an install due to intermittent network issues, strange flukes, shenanigans and whatnot. Each time they run the SetupMinecraft.sh they'll get a fresh start which would have helped with your situation too for sure.

Thanks for reporting this!

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

Successfully merging this pull request may close these issues.

2 participants