Skip to content

Commit

Permalink
Upgrading to Java 21: adopt Amazon Linux 2023. add java-package param…
Browse files Browse the repository at this point in the history
…eter to setup.sh.
  • Loading branch information
TSheahan committed Jul 1, 2024
1 parent 07a4ddd commit 30e153b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/
2 changes: 1 addition & 1 deletion cloudformation_server_stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Resources:
Type: AWS::EC2::Instance
Properties:
InstanceType: t3.large # 8GB, 2vcpu, 0.1056 USD/hour
ImageId: ami-02765a2a1f276edff # Amazon Linux 2 AMI (HVM) - Kernel 5.10, SSD Volume Type, 64-bit (x86) / https://ap-southeast-4.console.aws.amazon.com/ec2/home?region=ap-southeast-4#AMICatalog:
ImageId: ami-09c2ae4b214fc8e0e # Amazon Linux 2023 AMI 64-bit (x86) / https://ap-southeast-4.console.aws.amazon.com/ec2/home?region=ap-southeast-4#AMICatalog:
KeyName: tim_ssh_to_game_server # EC2 / key pairs
SecurityGroupIds:
- !Ref ServerSecurityGroup
Expand Down
14 changes: 10 additions & 4 deletions minecraft/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ fi
serverFolder=""
serverVersion=""
jarUrl=""
javaPackage=""

# Error function to display an error message and exit
error() {
echo "Error: $1" >&2
echo "Usage: $0 --server-folder=<path> --server-version=<version> --jar-url=<url>" >&2
echo "Usage: $0 --server-folder=<path> --server-version=<version> --jar-url=<url> --java-package=<package>" >&2
exit 1
}

Expand All @@ -51,7 +52,9 @@ do
--jar-url=*)
jarUrl="${arg#*=}"
;;
*)
--java-package=*)
$javaPackage="${arg#*=}"
;; *)
# Unknown option
error "Unknown argument ${arg}"
;;
Expand All @@ -68,16 +71,19 @@ fi
if [ -z "$jarUrl" ]; then
error "jar-url argument is required"
fi
if [ -z "$javaPackage" ]; then
error "java-package argument is required"
fi

# If all arguments are provided, proceed with the rest of the script
echo "Server Folder: $serverFolder"
echo "Server Version: $serverVersion"
echo "JAR URL: $jarUrl"

echo "Java package: $javaPackage"

echo "!! Install JDK"
yum update -y
yum install -y java-17-amazon-corretto-devel
yum install -y "$javaPackage"

echo "!! Check Java version"
java -version
Expand Down

0 comments on commit 30e153b

Please sign in to comment.