Skip to content

Commit

Permalink
docs: Add comments, descriptions and explanations for the scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Griefed committed Jul 23, 2024
1 parent 69f0468 commit 013d2d8
Show file tree
Hide file tree
Showing 4 changed files with 323 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,6 @@
# Java Install script generated by ServerPackCreator SPC_SERVERPACKCREATOR_VERSION_SPC.
# The template which was used in the generation of this script can be found at:
# https://github.com/Griefed/ServerPackCreator/blob/SPC_SERVERPACKCREATOR_VERSION_SPC/serverpackcreator-api/src/main/resources/de/griefed/resources/server_files/default_java_template.ps1
#
# By default, running Powershell scripts from untrusted sources is probably disabled on your system.
# As such, you will not be able to run the install_java.ps-scripts just yet. You need to allow running
# unsigned scripts first. See https://superuser.com/a/106363 for a short explanation on how to
# enable/allow running unsigned scripts with Powershell.
# ATTENTION:
# Bear in mind that this introduces a security risk on your system. After making the changes from the
# link above, you can run any Powershell script you like, and as such, introduce any and all security
# risk into your system. So, beware when running scripts from unknown sources.
#
# Powershell scripts by default can not be opened with a double-click if the path to said script
# contains spaces. If you wish to remedy this or want to read more about this behaviour, this article
# talks about it in great detail: https://blog.danskingdom.com/fix-problem-where-windows-powershell-cannot-run-script-whose-path-contains-spaces/
# You can thank Mircosoft for this. There is nothing the developers of ServerPackCreator can do about that.
# What you should do instead is:
# In your explorer, browse into the directory which contains your server pack.
# Shift-Rightclick into an empty space inside the directory
# Click "Open PowerShell window here"
# Type ".\install_java.ps1", without the "", and hit enter
#
# ATTENTION:
# Keep in mind though that things may still break when working with paths with spaces in them. If
# things still break with a path with spaces, even after trying the fixes from the link above, then I
# suggest moving things to a folder whose path contains no spaces.
#
# Depending on which Minecraft version is used in this server pack, a different Java version may be installed.
#
# ATTENTION:
# This script will NOT modify the JAVA_HOME variable for your user.

Function Global:RunJavaInstallation
{
Expand Down Expand Up @@ -98,4 +69,25 @@ Function Global:RunJavaInstallation
CMD /C ${Java} -version WARUM IST POWERSHELL SO EIN HAUFEN STINKENDE SCHEIßE

Write-Host "Installation finished. Returning to start-script."

<#
.SYNOPSIS
Download and install Java with the version required by the Minecraft server.
.DESCRIPTION
Download and install Java with the version required by the Minecraft version set in the variables.txt which was
also shipped with this modpack. Should you want to use a different Java version with your server pack, change
the RECOMMENDED_JAVA_VERSION. Likewise, you can change the vendor of the JDK to another one by changing
JDK_VENDOR in your variables.txt
Depending on which Minecraft version is used in this server pack, a different Java version may be installed.
ATTENTION:
This script will NOT modify the JAVA_HOME variable for your user.
A list of available JDK versions and vendors can be found at https://github.com/Jabba-Team/index/blob/main/index.json
Jabba is available at https://github.com/Jabba-Team/jabba
#>
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
###############################################################################################
############################################LICENSE#################################################
# Copyright (C) 2024 Griefed
#
# This script is free software; you can redistribute it and/or
Expand All @@ -18,8 +18,19 @@
# USA
#
# The full license can be found at https:github.com/Griefed/ServerPackCreator/blob/main/LICENSE
###############################################################################################
############################################DESCRIPTION#################################################
#
# This script uses Jabba to download and install Java with the version required by the Minecraft version set in the
# variables.txt which was also shipped with this modpack. Should you want to use a different Java version with your
# server pack, change the RECOMMENDED_JAVA_VERSION. Likewise, you can change the vendor of the JDK to another one by
# changing JDK_VENDOR in your variables.txt
#
# Depending on which Minecraft version is used in this server pack, a different Java version may be installed.
#
# A list of available JDK versions and vendors can be found at https://github.com/Jabba-Team/index/blob/main/index.json
# Jabba is available at https://github.com/Jabba-Team/jabba
#
############################################NOTES#################################################
# Java Install script generated by ServerPackCreator SPC_SERVERPACKCREATOR_VERSION_SPC.
# The template which was used in the generation of this script can be found at:
# https://github.com/Griefed/ServerPackCreator/blob/SPC_SERVERPACKCREATOR_VERSION_SPC/serverpackcreator-api/src/main/resources/de/griefed/resources/server_files/default_java_template.sh
Expand All @@ -35,10 +46,14 @@
# ATTENTION:
# This script will NOT modify the JAVA_HOME variable for your user.

# commandAvailable(command)
# Check whether the command $1 is available for execution. Can be used in if-statements.
commandAvailable() {
command -v "$1" > /dev/null 2>&1
}

# installJabba
# Downloads and installs Jabba, the software used to download and install Java for the Minecraft server.
installJabba() {
echo "Downloading and installing jabba."
if commandAvailable curl ; then
Expand All @@ -55,6 +70,8 @@ installJabba() {
GBLIC_VERSION=$(ldd --version | awk '/ldd/{print $NF}')
IFS="." read -ra GBLIC_SEMANTICS <<<"${GBLIC_VERSION}"

# Older Linux systems aren't supported, sadly. This mainly affects Ubuntu 20 and Linux distributions from around that time
# which use glibc versions older than 2.32 & 2.34.
if [[ ${GBLIC_SEMANTICS[1]} -lt 32 ]];then
echo "Jabba only supports systems with glibc 2.32 & 2.34 onward. You have $GBLIC_VERSION. Automated Java installation can not proceed."
echo "DO NOT ATTEMPT TO UPDATE OR UPGRADE YOUR INSTALLED VERSION OF GLIBC! DOING SO MAY CORRUPT YOUR ENTIRE SYSTEM!"
Expand Down
Loading

0 comments on commit 013d2d8

Please sign in to comment.