mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-03-19 04:55:57 +00:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a368f4cf57 | ||
|
|
08a4bde6c1 | ||
|
|
f68e979229 | ||
|
|
544b1f243d | ||
|
|
391e807c78 | ||
|
|
4099cde737 | ||
|
|
e56a74dc81 | ||
|
|
31b8535854 | ||
|
|
ed1bb73c22 | ||
|
|
b7ac28e902 | ||
|
|
3cb72797b6 | ||
|
|
6f1f8d7806 | ||
|
|
b06f1115d4 | ||
|
|
777ad31de0 | ||
|
|
8b977f8786 | ||
|
|
7c3139226c | ||
|
|
0ddabf3089 | ||
|
|
6cfc7e45ef | ||
|
|
9ea675bc89 | ||
|
|
42f90c8806 | ||
|
|
c8b6eac8fe | ||
|
|
d78272c1fa | ||
|
|
48ccdf128f | ||
|
|
2322dffd49 | ||
|
|
8a5e5bf01e | ||
|
|
99ed83022e | ||
|
|
07185534fb | ||
|
|
4fe55b5a28 | ||
|
|
bd503f224d | ||
|
|
b5c91647ca | ||
|
|
c359a0f2ac | ||
|
|
49d9f4a89d | ||
|
|
aebe35c9d4 | ||
|
|
a26361c79f |
@@ -1,5 +1,6 @@
|
|||||||
data
|
data
|
||||||
|
testdata
|
||||||
examples
|
examples
|
||||||
k8s-examples
|
k8s-examples
|
||||||
.idea
|
.idea
|
||||||
.git
|
.git
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
[start-*]
|
[start-*]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
end_of_line = lf
|
||||||
|
|||||||
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -8,12 +8,14 @@ on:
|
|||||||
- openj9-nightly
|
- openj9-nightly
|
||||||
- adopt11
|
- adopt11
|
||||||
- adopt13
|
- adopt13
|
||||||
|
- adopt14
|
||||||
tags:
|
tags:
|
||||||
- "[0-9]+.[0-9]+.[0-9]+"
|
- "[0-9]+.[0-9]+.[0-9]+"
|
||||||
- "[0-9]+.[0-9]+.[0-9]+-openj9"
|
- "[0-9]+.[0-9]+.[0-9]+-openj9"
|
||||||
- "[0-9]+.[0-9]+.[0-9]+-openj9-nightly"
|
- "[0-9]+.[0-9]+.[0-9]+-openj9-nightly"
|
||||||
- "[0-9]+.[0-9]+.[0-9]+-adopt11"
|
- "[0-9]+.[0-9]+.[0-9]+-adopt11"
|
||||||
- "[0-9]+.[0-9]+.[0-9]+-adopt13"
|
- "[0-9]+.[0-9]+.[0-9]+-adopt13"
|
||||||
|
- "[0-9]+.[0-9]+.[0-9]+-adopt14"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
|||||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||||
|
|
||||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||||
--var version=1.4.3 --var app=mc-server-runner --file {{.app}} \
|
--var version=1.5.0 --var app=mc-server-runner --file {{.app}} \
|
||||||
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||||
|
|
||||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||||
|
|||||||
76
README.md
76
README.md
@@ -1,7 +1,7 @@
|
|||||||
[](https://hub.docker.com/r/itzg/minecraft-server/)
|
[](https://hub.docker.com/r/itzg/minecraft-server/)
|
||||||
[](https://hub.docker.com/r/itzg/minecraft-server/)
|
[](https://hub.docker.com/r/itzg/minecraft-server/)
|
||||||
[](https://github.com/itzg/docker-minecraft-server/issues)
|
[](https://github.com/itzg/docker-minecraft-server/issues)
|
||||||
[](https://discord.gg/DXfKpjB)
|
[](https://discord.gg/DXfKpjB)
|
||||||
[](https://github.com/itzg/docker-minecraft-server/actions)
|
[](https://github.com/itzg/docker-minecraft-server/actions)
|
||||||
[](https://www.buymeacoffee.com/itzg)
|
[](https://www.buymeacoffee.com/itzg)
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ latest snapshot. See the _Versions_ section below for more information.
|
|||||||
|
|
||||||
To simply use the latest stable version, run
|
To simply use the latest stable version, run
|
||||||
|
|
||||||
docker run -d -p 25565:25565 --name mc itzg/minecraft-server
|
docker run -d -p 25565:25565 --name mc -e EULA=TRUE itzg/minecraft-server
|
||||||
|
|
||||||
where the standard server port, 25565, will be exposed on your host machine.
|
where the standard server port, 25565, will be exposed on your host machine.
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@ With that you can easily view the logs, stop, or re-start the container:
|
|||||||
docker stop mc
|
docker stop mc
|
||||||
|
|
||||||
docker start mc
|
docker start mc
|
||||||
|
*Be sure to always include `-e EULA=TRUE` in your commands, as Mojang/Microsoft requires EULA acceptance.*
|
||||||
|
|
||||||
## Looking for a Bedrock Dedicated Server
|
## Looking for a Bedrock Dedicated Server
|
||||||
|
|
||||||
@@ -146,6 +147,7 @@ To use a different version of Java, please use a docker tag to run your Minecraf
|
|||||||
| Tag name | Description | Linux |
|
| Tag name | Description | Linux |
|
||||||
| -------------- | ------------------------------------------- | ------------ |
|
| -------------- | ------------------------------------------- | ------------ |
|
||||||
| latest | **Default**. Uses Java version 8 update 212 | Alpine Linux |
|
| latest | **Default**. Uses Java version 8 update 212 | Alpine Linux |
|
||||||
|
| adopt14 | Uses Java version 14 latest update | Alpine Linux |
|
||||||
| adopt13 | Uses Java version 13 latest update | Alpine Linux |
|
| adopt13 | Uses Java version 13 latest update | Alpine Linux |
|
||||||
| adopt11 | Uses Java version 11 latest update | Alpine Linux |
|
| adopt11 | Uses Java version 11 latest update | Alpine Linux |
|
||||||
| openj9 | Uses Eclipse OpenJ9 JVM | Alpine Linux |
|
| openj9 | Uses Eclipse OpenJ9 JVM | Alpine Linux |
|
||||||
@@ -225,6 +227,10 @@ describes period of the daemonized state machine, that handles the pausing of th
|
|||||||
|
|
||||||
The [examples directory](https://github.com/itzg/docker-minecraft-server/tree/master/examples) also provides examples of deploying the [itzg/minecraft-server](https://hub.docker.com/r/itzg/minecraft-server/) Docker image.
|
The [examples directory](https://github.com/itzg/docker-minecraft-server/tree/master/examples) also provides examples of deploying the [itzg/minecraft-server](https://hub.docker.com/r/itzg/minecraft-server/) Docker image.
|
||||||
|
|
||||||
|
### Amazon Web Services (AWS) Deployment
|
||||||
|
|
||||||
|
If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Minecraft Server Deployment (CloudFormation) repository](https://github.com/vatertime/minecraft-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use.
|
||||||
|
|
||||||
## Running a Forge Server
|
## Running a Forge Server
|
||||||
|
|
||||||
Enable Forge server mode by adding a `-e TYPE=FORGE` to your command-line.
|
Enable Forge server mode by adding a `-e TYPE=FORGE` to your command-line.
|
||||||
@@ -269,10 +275,20 @@ the `/path/on/host` folder contents look like:
|
|||||||
├── ops.json
|
├── ops.json
|
||||||
├── server.properties
|
├── server.properties
|
||||||
├── whitelist.json
|
├── whitelist.json
|
||||||
|
├── worlds
|
||||||
|
│ └── ... PLACE MAPS IN THEIR OWN FOLDERS HERE ...
|
||||||
└── ...
|
└── ...
|
||||||
```
|
```
|
||||||
|
|
||||||
If you add mods while the container is running, you'll need to restart it to pick those
|
Providing a presistent `/data` mount is a good idea, both to persist the game world and to allow for the manual configuration which is sometimes needed.
|
||||||
|
|
||||||
|
For instance, imagine a scenario when the initial launch has completed, but you now want to change the worldmap for your server.
|
||||||
|
|
||||||
|
Assuming you have a shared directory to your container, you can then (after first launch) drag and drop your premade maps or worlds into the `\worlds\` directory. **Note:** each world should be placed in its own folder under the `\worlds\` directory.
|
||||||
|
|
||||||
|
Once your maps are in the proper path, you can then specify which map the server uses by changing the `level-name` value in `server.properties` to match the name of your map.
|
||||||
|
|
||||||
|
If you add mods or make changes to `server.properties` while the container is running, you'll need to restart it to pick those
|
||||||
up:
|
up:
|
||||||
|
|
||||||
docker stop mc
|
docker stop mc
|
||||||
@@ -285,12 +301,14 @@ or downloading a world with the `WORLD` option.
|
|||||||
|
|
||||||
There are two additional volumes that can be mounted; `/mods` and `/config`.
|
There are two additional volumes that can be mounted; `/mods` and `/config`.
|
||||||
Any files in either of these filesystems will be copied over to the main
|
Any files in either of these filesystems will be copied over to the main
|
||||||
`/data` filesystem before starting Minecraft.
|
`/data` filesystem before starting Minecraft. If you want old mods to be removed as the `/mods` content is updated, then add `-e REMOVE_OLD_MODS=TRUE`.
|
||||||
|
|
||||||
This works well if you want to have a common set of modules in a separate
|
This works well if you want to have a common set of modules in a separate
|
||||||
location, but still have multiple worlds with different server requirements
|
location, but still have multiple worlds with different server requirements
|
||||||
in either persistent volumes or a downloadable archive.
|
in either persistent volumes or a downloadable archive.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Replacing variables inside configs
|
### Replacing variables inside configs
|
||||||
|
|
||||||
Sometimes you have mods or plugins that require configuration information that is only available at runtime.
|
Sometimes you have mods or plugins that require configuration information that is only available at runtime.
|
||||||
@@ -390,7 +408,7 @@ secrets:
|
|||||||
The content of `db_password`:
|
The content of `db_password`:
|
||||||
|
|
||||||
ug23u3bg39o-ogADSs
|
ug23u3bg39o-ogADSs
|
||||||
|
|
||||||
## Running a Bukkit/Spigot server
|
## Running a Bukkit/Spigot server
|
||||||
|
|
||||||
Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT` or `-e TYPE=SPIGOT` to your command-line.
|
Enable Bukkit/Spigot server mode by adding a `-e TYPE=BUKKIT` or `-e TYPE=SPIGOT` to your command-line.
|
||||||
@@ -408,9 +426,9 @@ You can build spigot from source by adding `-e BUILD_FROM_SOURCE=true`
|
|||||||
|
|
||||||
If you have attached a host directory to the `/data` volume, then you can install plugins within the `plugins` subdirectory. You can also [attach a `/plugins` volume](#deploying-plugins-from-attached-volume). If you add plugins while the container is running, you'll need to restart it to pick those up.
|
If you have attached a host directory to the `/data` volume, then you can install plugins within the `plugins` subdirectory. You can also [attach a `/plugins` volume](#deploying-plugins-from-attached-volume). If you add plugins while the container is running, you'll need to restart it to pick those up.
|
||||||
|
|
||||||
## Running a PaperSpigot server
|
## Running a Paper server
|
||||||
|
|
||||||
Enable PaperSpigot server mode by adding a `-e TYPE=PAPER` to your command-line.
|
Enable Paper server mode by adding a `-e TYPE=PAPER` to your command-line.
|
||||||
|
|
||||||
By default the container will run the latest build of [Paper server](https://papermc.io/downloads)
|
By default the container will run the latest build of [Paper server](https://papermc.io/downloads)
|
||||||
but you can also choose to run a specific build with `-e PAPERBUILD=205`.
|
but you can also choose to run a specific build with `-e PAPERBUILD=205`.
|
||||||
@@ -419,7 +437,7 @@ but you can also choose to run a specific build with `-e PAPERBUILD=205`.
|
|||||||
-e TYPE=PAPER \
|
-e TYPE=PAPER \
|
||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
|
|
||||||
If you are hosting your own copy of PaperSpigot you can override the download URL with:
|
If you are hosting your own copy of Paper you can override the download URL with:
|
||||||
|
|
||||||
- -e PAPER_DOWNLOAD_URL=<url>
|
- -e PAPER_DOWNLOAD_URL=<url>
|
||||||
|
|
||||||
@@ -469,7 +487,7 @@ A [Catserver](http://catserver.moe/) type server can be used with
|
|||||||
[Feed the Beast application](https://www.feed-the-beast.com/) modpacks are supported by using `-e TYPE=FTBA` (**note** the "A" at the end of the type). This server type will automatically take care of downloading and installing the modpack and appropriate version of Forge, so the `VERSION` does not need to be specified.
|
[Feed the Beast application](https://www.feed-the-beast.com/) modpacks are supported by using `-e TYPE=FTBA` (**note** the "A" at the end of the type). This server type will automatically take care of downloading and installing the modpack and appropriate version of Forge, so the `VERSION` does not need to be specified.
|
||||||
|
|
||||||
### Environment Variables:
|
### Environment Variables:
|
||||||
- `FTB_MODPACK_ID`: **required**, the numerical ID of the modpack to install. The ID can be located by finding the modpack at [Neptune FTB](https://ftb.neptunepowered.org/) and using the "Pack ID"
|
- `FTB_MODPACK_ID`: **required**, the numerical ID of the modpack to install. The ID can be located by [finding the modpack](https://www.feed-the-beast.com/modpack) and using the "ID" displayed next to the name
|
||||||
- `FTB_MODPACK_VERSION_ID`: optional, the numerical Id of the version to install. If not specified, the latest version will be installed. The "Version ID" can be obtained by drilling into the Versions tab and clicking a specific version.
|
- `FTB_MODPACK_VERSION_ID`: optional, the numerical Id of the version to install. If not specified, the latest version will be installed. The "Version ID" can be obtained by drilling into the Versions tab and clicking a specific version.
|
||||||
|
|
||||||
### Upgrading
|
### Upgrading
|
||||||
@@ -544,29 +562,31 @@ Just change it with `SPONGEBRANCH`, such as:
|
|||||||
|
|
||||||
## Running a Fabric Server
|
## Running a Fabric Server
|
||||||
|
|
||||||
Enable Fabric server mode by adding a `-e TYPE=FABRIC` to your command-line.
|
Enable [Fabric server](http://fabricmc.net/use/) mode by adding a `-e TYPE=FABRIC` to your command-line. By default, the container will run the latest version, but you can also choose to run a specific version with `VERSION`.
|
||||||
By default the container will run the latest version of [Fabric server](http://fabricmc.net/use/)
|
|
||||||
but you can also choose to run a specific version with `-e FABRICVERSION=0.5.0.32`.
|
|
||||||
|
|
||||||
$ docker run -d -v /path/on/host:/data \
|
```
|
||||||
-e TYPE=FABRIC -e FABRICVERSION=0.5.0.32 \
|
docker run -d -v /path/on/host:/data \
|
||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
-e TYPE=FABRIC \
|
||||||
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
|
```
|
||||||
|
|
||||||
To use a pre-downloaded Fabric installer, place it in the attached `/data` directory and
|
A specific installer version can be requested using `FABRIC_INSTALLER_VERSION`.
|
||||||
specify the name of the installer file with `FABRIC_INSTALLER`, such as:
|
|
||||||
|
|
||||||
$ docker run -d -v /path/on/host:/data ... \
|
To use a pre-downloaded Fabric installer, place it in a directory attached into the container, such as the `/data` volume and specify the name of the installer file with `FABRIC_INSTALLER`, such as:
|
||||||
-e FABRIC_INSTALLER=fabric-installer-0.5.0.32.jar ...
|
|
||||||
|
|
||||||
To download a Fabric installer from a custom location, such as your own file repository, specify
|
```
|
||||||
the URL with `FABRIC_INSTALLER_URL`, such as:
|
docker run -d -v /path/on/host:/data ... \
|
||||||
|
-e FABRIC_INSTALLER=fabric-installer-0.5.0.32.jar ...
|
||||||
|
```
|
||||||
|
|
||||||
$ docker run -d -v /path/on/host:/data ... \
|
To download a Fabric installer from a custom location, such as your own file repository, specify the URL with `FABRIC_INSTALLER_URL`, such as:
|
||||||
-e FORGE_INSTALLER_URL=http://HOST/fabric-installer-0.5.0.32.jar ...
|
|
||||||
|
|
||||||
In both of the cases above, there is no need for the `VERSION` or `FABRICVERSION` variables.
|
```
|
||||||
|
docker run -d -v /path/on/host:/data ... \
|
||||||
|
-e FABRIC_INSTALLER_URL=http://HOST/fabric-installer-0.5.0.32.jar ...
|
||||||
|
```
|
||||||
|
|
||||||
In order to add mods, you have two options.
|
In order to add mods, you have two options:
|
||||||
|
|
||||||
### Using the /data volume
|
### Using the /data volume
|
||||||
|
|
||||||
@@ -1091,10 +1111,14 @@ Some older versions (pre-1.14) of Spigot required `--noconsole` to be passed whe
|
|||||||
Some older servers get confused and think that the GUI interface is enabled. You can explicitly
|
Some older servers get confused and think that the GUI interface is enabled. You can explicitly
|
||||||
disable that by passing `-e GUI=FALSE`.
|
disable that by passing `-e GUI=FALSE`.
|
||||||
|
|
||||||
|
### Stop Duration
|
||||||
|
|
||||||
|
When the container is signalled to stop, the Minecraft process wrapper will attempt to send a "stop" command via RCON or console and waits for the process to gracefully finish. By defaul it waits 60 seconds, but that duration can be configured by setting the environment variable `STOP_DURATION` to the number of seconds.
|
||||||
|
|
||||||
## Running on RaspberryPi
|
## Running on RaspberryPi
|
||||||
|
|
||||||
To run this image on a RaspberryPi 3 B+, 4, or newer, use the image tag
|
To run this image on a RaspberryPi 3 B+, 4, or newer, use the image tag
|
||||||
|
|
||||||
itzg/minecraft-server:multiarch
|
itzg/minecraft-server:multiarch
|
||||||
|
|
||||||
> NOTE: you may need to lower the memory allocation, such as `-e MEMORY=750m`
|
> NOTE: you may need to lower the memory allocation, such as `-e MEMORY=750m`
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#set -x
|
#set -x
|
||||||
# Use this variable to indicate a list of branches that docker hub is watching
|
# Use this variable to indicate a list of branches that docker hub is watching
|
||||||
branches_list=('openj9' 'openj9-nightly' 'adopt11' 'adopt13' 'multiarch')
|
branches_list=('openj9' 'openj9-nightly' 'adopt11' 'adopt13' 'adopt14' 'multiarch' 'multiarch-latest')
|
||||||
|
|
||||||
function TrapExit {
|
function TrapExit {
|
||||||
echo "Checking out back in master"
|
echo "Checking out back in master"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
. /start-utils
|
. /start-utils
|
||||||
|
|
||||||
sudo /usr/sbin/knockd -c /autopause/knockd-config.cfg -d
|
sudo /usr/sbin/knockd -c /tmp/knockd-config.cfg -d
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ rcon_client_exists() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mc_server_listening() {
|
mc_server_listening() {
|
||||||
[[ -n $(netstat -tln | grep "0.0.0.0:$SERVER_PORT" | grep LISTEN) ]]
|
[[ -n $(netstat -tln | grep -e "0.0.0.0:$SERVER_PORT" -e ":::$SERVER_PORT" | grep LISTEN) ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
java_clients_connected() {
|
java_clients_connected() {
|
||||||
@@ -29,7 +29,7 @@ java_clients_connected() {
|
|||||||
# remember, that the host network mode does not work with autopause because of the knockd utility
|
# remember, that the host network mode does not work with autopause because of the knockd utility
|
||||||
for (( i=0; i<${#connections[@]}; i++ ))
|
for (( i=0; i<${#connections[@]}; i++ ))
|
||||||
do
|
do
|
||||||
if [[ ! $(echo "${connections[$i]}" | awk '{print $5}') =~ ^\s*127\.0\.0\.1:.*$ ]] ; then
|
if [[ ! $(echo "${connections[$i]}" | awk '{print $5}') =~ ^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$ ]] ; then
|
||||||
# not localhost
|
# not localhost
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
5
start
5
start
@@ -36,11 +36,6 @@ if [ $(id -u) = 0 ]; then
|
|||||||
chown -R ${runAsUser}:${runAsGroup} /data
|
chown -R ${runAsUser}:${runAsGroup} /data
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(stat -c "%u" /autopause) != $UID ]]; then
|
|
||||||
log "Changing ownership of /autopause to $UID ..."
|
|
||||||
chown -R ${runAsUser}:${runAsGroup} /autopause
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ${SKIP_NSSWITCH_CONF^^} != TRUE ]]; then
|
if [[ ${SKIP_NSSWITCH_CONF^^} != TRUE ]]; then
|
||||||
echo 'hosts: files dns' > /etc/nsswitch.conf
|
echo 'hosts: files dns' > /etc/nsswitch.conf
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -4,18 +4,20 @@
|
|||||||
|
|
||||||
log "Autopause functionality enabled"
|
log "Autopause functionality enabled"
|
||||||
|
|
||||||
|
cp /autopause/knockd-config.cfg /tmp/knockd-config.cfg
|
||||||
|
|
||||||
# update server port to listen to
|
# update server port to listen to
|
||||||
regseq="^\s*sequence\s*=\s*$SERVER_PORT\s*$"
|
regseq="^\s*sequence\s*=\s*$SERVER_PORT\s*$"
|
||||||
linenum=$(grep -nm1 sequence /autopause/knockd-config.cfg | cut -d : -f 1 | tail -n1)
|
linenum=$(grep -nm1 sequence /tmp/knockd-config.cfg | cut -d : -f 1 | tail -n1)
|
||||||
if ! [[ $(awk "NR==$linenum" /autopause/knockd-config.cfg) =~ $regseq ]]; then
|
if ! [[ $(awk "NR==$linenum" /tmp/knockd-config.cfg) =~ $regseq ]]; then
|
||||||
sed -i "${linenum}s/sequence.*/sequence = $SERVER_PORT/" /autopause/knockd-config.cfg
|
sed -i "${linenum}s/sequence.*/sequence = $SERVER_PORT/" /tmp/knockd-config.cfg
|
||||||
log "Updated server port in knockd config"
|
log "Updated server port in knockd config"
|
||||||
fi
|
fi
|
||||||
# update rcon port to listen to
|
# update rcon port to listen to
|
||||||
regseq="^\s*sequence\s*=\s*$RCON_PORT\s*$"
|
regseq="^\s*sequence\s*=\s*$RCON_PORT\s*$"
|
||||||
linenum=$(grep -nm2 sequence /autopause/knockd-config.cfg | cut -d : -f 1 | tail -n1)
|
linenum=$(grep -nm2 sequence /tmp/knockd-config.cfg | cut -d : -f 1 | tail -n1)
|
||||||
if ! [[ $(awk "NR==$linenum" /autopause/knockd-config.cfg) =~ $regseq ]]; then
|
if ! [[ $(awk "NR==$linenum" /tmp/knockd-config.cfg) =~ $regseq ]]; then
|
||||||
sed -i "${linenum}s/sequence.*/sequence = $RCON_PORT/" /autopause/knockd-config.cfg
|
sed -i "${linenum}s/sequence.*/sequence = $RCON_PORT/" /tmp/knockd-config.cfg
|
||||||
log "Updated rcon port in knockd config"
|
log "Updated rcon port in knockd config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,7 @@ shopt -s nullglob
|
|||||||
export HOME=/data
|
export HOME=/data
|
||||||
|
|
||||||
if [ ! -e /data/eula.txt ]; then
|
if [ ! -e /data/eula.txt ]; then
|
||||||
EULA="${EULA,,}"
|
if ! isTrue "$EULA"; then
|
||||||
if [ "$EULA" != "true" ]; then
|
|
||||||
log ""
|
log ""
|
||||||
log "Please accept the Minecraft EULA at"
|
log "Please accept the Minecraft EULA at"
|
||||||
log " https://account.mojang.com/documents/minecraft_eula"
|
log " https://account.mojang.com/documents/minecraft_eula"
|
||||||
@@ -19,12 +18,7 @@ if [ ! -e /data/eula.txt ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "# Generated via Docker on $(date)" > /data/eula.txt
|
writeEula
|
||||||
|
|
||||||
if ! echo "eula=$EULA" >> /data/eula.txt; then
|
|
||||||
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -109,7 +103,7 @@ case "${TYPE^^}" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
FTB|CURSEFORGE)
|
FTB|CURSEFORGE)
|
||||||
exec ${SCRIPTS:-/}start-deployFTB "$@"
|
exec ${SCRIPTS:-/}start-deployCF "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
VANILLA)
|
VANILLA)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -58,16 +59,24 @@ function downloadSpigot {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [[ ${VERSION^^} = LATEST ]]; then
|
||||||
|
VANILLA_VERSION=$(restify https://getbukkit.org/download/spigot --attribute='property=og:title' | jq -r '.[0] | .attributes | select(.property == "og:title") | .content | split(" ") | .[-1]')
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z $downloadUrl ]]; then
|
if [[ -z $downloadUrl ]]; then
|
||||||
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar"
|
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
setServerVar
|
||||||
if [ -f $SERVER ]; then
|
if [ -f $SERVER ]; then
|
||||||
# tell curl to only download when newer
|
# tell curl to only download when newer
|
||||||
zarg="-z $SERVER"
|
curlArgs="-z $SERVER"
|
||||||
|
fi
|
||||||
|
if isDebugging; then
|
||||||
|
curlArgs="$curlArgs -v"
|
||||||
fi
|
fi
|
||||||
log "Downloading $match from $downloadUrl ..."
|
log "Downloading $match from $downloadUrl ..."
|
||||||
curl -fsSL -o $SERVER $zarg "$downloadUrl"
|
curl -fsSL -o $SERVER $curlArgs "$downloadUrl"
|
||||||
if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then
|
if [[ $? != 0 || $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
@@ -76,6 +85,13 @@ ERROR: failed to download from $downloadUrl
|
|||||||
exact version, such as 1.4.6-R0.4-SNAPSHOT or 1.8-R0.1-SNAPSHOT-LATEST
|
exact version, such as 1.4.6-R0.4-SNAPSHOT or 1.8-R0.1-SNAPSHOT-LATEST
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
if isDebugging && [[ $(grep -c "DOCTYPE html" $SERVER) != 0 ]]; then
|
||||||
|
cat $SERVER
|
||||||
|
fi
|
||||||
|
|
||||||
|
# remove invalid download
|
||||||
|
rm $SERVER
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -83,17 +99,19 @@ EOF
|
|||||||
export JVM_OPTS
|
export JVM_OPTS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setServerVar {
|
||||||
case "$TYPE" in
|
case "$TYPE" in
|
||||||
*BUKKIT|*bukkit)
|
*BUKKIT|*bukkit)
|
||||||
export SERVER=craftbukkit_server-${VANILLA_VERSION}.jar
|
export SERVER=craftbukkit_server-${VANILLA_VERSION}.jar
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
export SERVER=spigot_server-${VANILLA_VERSION}.jar
|
export SERVER=spigot_server-${VANILLA_VERSION}.jar
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then
|
if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then
|
||||||
|
setServerVar
|
||||||
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
if [ ! -f $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
||||||
buildSpigotFromSource
|
buildSpigotFromSource
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
export FTB_BASE_DIR=/data/FeedTheBeast
|
export FTB_BASE_DIR=/data/FeedTheBeast
|
||||||
legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
|
legacyJavaFixerUrl=https://ftb.forgecdn.net/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
|
||||||
export TYPE=FEED-THE-BEAST
|
export TYPE=FEED-THE-BEAST
|
||||||
|
|
||||||
FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD}
|
FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD}
|
||||||
@@ -14,7 +15,7 @@ log "Looking for Feed-The-Beast / CurseForge server modpack."
|
|||||||
requireVar FTB_SERVER_MOD
|
requireVar FTB_SERVER_MOD
|
||||||
|
|
||||||
if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
|
if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
|
||||||
if ! [ -f ${FTB_SERVER_MOD} ]; then
|
if ! [ -f "${FTB_SERVER_MOD}" ]; then
|
||||||
log "ERROR unable to find requested modpack file ${FTB_SERVER_MOD}"
|
log "ERROR unable to find requested modpack file ${FTB_SERVER_MOD}"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
@@ -27,7 +28,7 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
|
|||||||
|
|
||||||
serverJar=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar")
|
serverJar=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar")
|
||||||
if [[ "${serverJar}" ]]; then
|
if [[ "${serverJar}" ]]; then
|
||||||
rm -rf $(dirname "${serverJar}")/{mods,*.jar,libraries,resources,scripts}
|
rm -rf $(dirname "${serverJar}")/{mods,*.jar,libraries,resources,scripts,config}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
needsInstall=false
|
needsInstall=false
|
||||||
@@ -37,22 +38,25 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
|
|||||||
if $needsInstall; then
|
if $needsInstall; then
|
||||||
log "Unpacking FTB server modpack ${FTB_SERVER_MOD} ..."
|
log "Unpacking FTB server modpack ${FTB_SERVER_MOD} ..."
|
||||||
mkdir -p ${FTB_BASE_DIR}
|
mkdir -p ${FTB_BASE_DIR}
|
||||||
unzip -o ${FTB_SERVER_MOD} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
unzip -o "${FTB_SERVER_MOD}" -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
||||||
|
|
||||||
forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar")
|
serverJar=$(find ${FTB_BASE_DIR} -path "*/libraries/*" -prune -type f -o -not -name "forge*installer.jar" -name "forge*.jar")
|
||||||
if [[ -z "${forgeInstallerJar}" ]]; then
|
if [[ -z "$serverJar" ]]; then
|
||||||
log "ERROR Unable to find forge installer in modpack."
|
forgeInstallerJar=$(find ${FTB_BASE_DIR} -name "forge*installer.jar")
|
||||||
log " Make sure you downloaded the server files."
|
if [[ -z "${forgeInstallerJar}" ]]; then
|
||||||
exit 2
|
log "ERROR Unable to find forge installer in modpack."
|
||||||
|
log " Make sure you downloaded the server files."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Installing forge server"
|
||||||
|
(cd $(dirname "${forgeInstallerJar}"); java -jar $(basename "${forgeInstallerJar}") --installServer) | awk '{printf "."} END {print ""}'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Installing forge server"
|
|
||||||
(cd $(dirname "${forgeInstallerJar}"); java -jar $(basename ${forgeInstallerJar}) --installServer) | awk '{printf "."} END {print ""}'
|
|
||||||
|
|
||||||
echo "${FTB_SERVER_MOD}" > $installMarker
|
echo "${FTB_SERVER_MOD}" > $installMarker
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export SERVER=$(find ${FTB_BASE_DIR} -not -name "forge*installer.jar" -name "forge*.jar")
|
export SERVER=$(find ${FTB_BASE_DIR} -path "*/libraries/*" -prune -type f -o -not -name "forge*installer.jar" -name "forge*.jar")
|
||||||
if [[ -z "${SERVER}" || ! -f "${SERVER}" ]]; then
|
if [[ -z "${SERVER}" || ! -f "${SERVER}" ]]; then
|
||||||
log "ERROR unable to locate installed forge server jar"
|
log "ERROR unable to locate installed forge server jar"
|
||||||
isDebugging && find ${FTB_BASE_DIR} -name "forge*.jar"
|
isDebugging && find ${FTB_BASE_DIR} -name "forge*.jar"
|
||||||
@@ -89,7 +93,7 @@ fi
|
|||||||
# this allows saving just the world separate from the rest of the data directory
|
# this allows saving just the world separate from the rest of the data directory
|
||||||
if [[ $startScriptCount = 0 ]]; then
|
if [[ $startScriptCount = 0 ]]; then
|
||||||
srv_modpack=${FTB_SERVER_MOD}
|
srv_modpack=${FTB_SERVER_MOD}
|
||||||
if isURL ${srv_modpack}; then
|
if isURL "${srv_modpack}"; then
|
||||||
case $srv_modpack in
|
case $srv_modpack in
|
||||||
https://www.feed-the-beast.com/*/download|https://www.curseforge.com/minecraft/modpacks/*/download/*/file)
|
https://www.feed-the-beast.com/*/download|https://www.curseforge.com/minecraft/modpacks/*/download/*/file)
|
||||||
;;
|
;;
|
||||||
@@ -107,19 +111,19 @@ if [[ $startScriptCount = 0 ]]; then
|
|||||||
fi
|
fi
|
||||||
srv_modpack=$downloaded
|
srv_modpack=$downloaded
|
||||||
fi
|
fi
|
||||||
if [[ ${srv_modpack:0:5} == "data/" ]]; then
|
if [[ "${srv_modpack:0:5}" == "data/" ]]; then
|
||||||
# Prepend with "/"
|
# Prepend with "/"
|
||||||
srv_modpack=/${srv_modpack}
|
srv_modpack="/${srv_modpack}"
|
||||||
fi
|
fi
|
||||||
if [[ ! ${srv_modpack:0:1} == "/" ]]; then
|
if [[ ! "${srv_modpack:0:1}" == "/" ]]; then
|
||||||
# If not an absolute path, assume file is in "/data"
|
# If not an absolute path, assume file is in "/data"
|
||||||
srv_modpack=/data/${srv_modpack}
|
srv_modpack=/data/${srv_modpack}
|
||||||
fi
|
fi
|
||||||
if [[ ! -f ${srv_modpack} ]]; then
|
if [[ ! -f "${srv_modpack}" ]]; then
|
||||||
log "FTB server modpack ${srv_modpack} not found."
|
log "FTB server modpack ${srv_modpack} not found."
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
if [[ ! ${srv_modpack: -4} == ".zip" ]]; then
|
if [[ ! "${srv_modpack: -4}" == ".zip" ]]; then
|
||||||
log "FTB server modpack ${srv_modpack} is not a zip archive."
|
log "FTB server modpack ${srv_modpack} is not a zip archive."
|
||||||
log "Please set FTB_SERVER_MOD to a file with a .zip extension."
|
log "Please set FTB_SERVER_MOD to a file with a .zip extension."
|
||||||
exit 2
|
exit 2
|
||||||
@@ -127,7 +131,7 @@ if [[ $startScriptCount = 0 ]]; then
|
|||||||
|
|
||||||
log "Unpacking FTB server modpack ${srv_modpack} ..."
|
log "Unpacking FTB server modpack ${srv_modpack} ..."
|
||||||
mkdir -p ${FTB_BASE_DIR}
|
mkdir -p ${FTB_BASE_DIR}
|
||||||
unzip -o ${srv_modpack} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
unzip -o "${srv_modpack}" -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then
|
if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then
|
||||||
@@ -165,7 +169,7 @@ export FTB_SERVER_START=$(find "${FTB_BASE_DIR}" $entryScriptExpr)
|
|||||||
|
|
||||||
export FTB_DIR=$(dirname "${FTB_SERVER_START}")
|
export FTB_DIR=$(dirname "${FTB_SERVER_START}")
|
||||||
chmod a+x "${FTB_SERVER_START}"
|
chmod a+x "${FTB_SERVER_START}"
|
||||||
grep fml.queryResult=confirm ${FTB_SERVER_START} > /dev/null || \
|
grep fml.queryResult=confirm "${FTB_SERVER_START}" > /dev/null || \
|
||||||
sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' "${FTB_SERVER_START}"
|
sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' "${FTB_SERVER_START}"
|
||||||
sed -i 's/.*read.*Restart now/#\0/' "${FTB_SERVER_START}"
|
sed -i 's/.*read.*Restart now/#\0/' "${FTB_SERVER_START}"
|
||||||
legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar"
|
legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar"
|
||||||
@@ -7,36 +7,34 @@ export TYPE=FABRIC
|
|||||||
|
|
||||||
FABRIC_INSTALLER=${FABRIC_INSTALLER:-}
|
FABRIC_INSTALLER=${FABRIC_INSTALLER:-}
|
||||||
FABRIC_INSTALLER_URL=${FABRIC_INSTALLER_URL:-}
|
FABRIC_INSTALLER_URL=${FABRIC_INSTALLER_URL:-}
|
||||||
FABRICVERSION=${FABRICVERSION:-LATEST}
|
FABRIC_INSTALLER_VERSION=${FABRIC_INSTALLER_VERSION:-${FABRICVERSION:-LATEST}}
|
||||||
if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then
|
if [[ -z $FABRIC_INSTALLER && -z $FABRIC_INSTALLER_URL ]]; then
|
||||||
log "Checking Fabric version information."
|
log "Checking Fabric version information."
|
||||||
case $FABRICVERSION in
|
case $FABRIC_INSTALLER_VERSION in
|
||||||
LATEST)
|
LATEST)
|
||||||
FABRIC_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml)
|
FABRIC_INSTALLER_VERSION=$(maven-metadata-release https://maven.fabricmc.net/net/fabricmc/fabric-installer/maven-metadata.xml)
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
FABRIC_VERSION=$FABRICVERSION
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
FABRIC_INSTALLER="/tmp/fabric-installer-$FABRIC_VERSION.jar"
|
FABRIC_INSTALLER="/tmp/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar"
|
||||||
|
markerVersion=$FABRIC_INSTALLER_VERSION
|
||||||
|
|
||||||
elif [[ -z $FABRIC_INSTALLER ]]; then
|
elif [[ -z $FABRIC_INSTALLER ]]; then
|
||||||
FABRIC_INSTALLER="/tmp/fabric-installer.jar"
|
FABRIC_INSTALLER="/tmp/fabric-installer.jar"
|
||||||
|
markerVersion=custom
|
||||||
elif [[ ! -e $FABRIC_INSTALLER ]]; then
|
elif [[ ! -e $FABRIC_INSTALLER ]]; then
|
||||||
log "ERROR: the given Fabric installer doesn't exist : $FABRIC_INSTALLER"
|
log "ERROR: the given Fabric installer doesn't exist : $FABRIC_INSTALLER"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
installMarker="/data/.fabric-installed-${VANILLA_VERSION}-${FABRIC_VERSION:-manual}"
|
installMarker="/data/.fabric-installed-${VANILLA_VERSION}-${markerVersion}"
|
||||||
|
|
||||||
debug Checking for installMarker ${installMarker}
|
debug Checking for installMarker ${installMarker}
|
||||||
if [[ ! -e $installMarker ]]; then
|
if [[ ! -e $installMarker ]]; then
|
||||||
if [[ ! -e $FABRIC_INSTALLER ]]; then
|
if [[ ! -e $FABRIC_INSTALLER ]]; then
|
||||||
if [[ -z $FABRIC_INSTALLER_URL ]]; then
|
if [[ -z $FABRIC_INSTALLER_URL ]]; then
|
||||||
log "Downloading $FABRIC_VERSION"
|
log "Downloading installer version $FABRIC_INSTALLER_VERSION"
|
||||||
downloadUrl="https://maven.fabricmc.net/net/fabricmc/fabric-installer/$FABRIC_VERSION/fabric-installer-$FABRIC_VERSION.jar"
|
downloadUrl="https://maven.fabricmc.net/net/fabricmc/fabric-installer/${FABRIC_INSTALLER_VERSION}/fabric-installer-${FABRIC_INSTALLER_VERSION}.jar"
|
||||||
log "...trying $downloadUrl"
|
log "...trying $downloadUrl"
|
||||||
curl -o $FABRIC_INSTALLER -fsSL $downloadUrl
|
curl -o $FABRIC_INSTALLER -fsSL $downloadUrl
|
||||||
else
|
else
|
||||||
@@ -49,9 +47,9 @@ if [[ ! -e $installMarker ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if isDebugging; then
|
if isDebugging; then
|
||||||
debug "Installing Fabric $FABRIC_VERSION using $FABRIC_INSTALLER with mcversion ${VANILLA_VERSION}"
|
debug "Installing Fabric ${VANILLA_VERSION} using $FABRIC_INSTALLER"
|
||||||
else
|
else
|
||||||
log "Installing Fabric $FABRIC_VERSION using $FABRIC_INSTALLER"
|
log "Installing Fabric using $FABRIC_INSTALLER"
|
||||||
fi
|
fi
|
||||||
tries=3
|
tries=3
|
||||||
set +e
|
set +e
|
||||||
|
|||||||
@@ -1,19 +1,57 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
set -o pipefail
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
: ${PAPERBUILD:=latest}
|
# PaperMC API v2 docs : https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config
|
||||||
export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar
|
|
||||||
|
|
||||||
if [ -f "$SERVER" ] && ! isTrue "$FORCE_REDOWNLOAD"; then
|
build=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}" -H "accept: application/json" \
|
||||||
zarg="-z '$SERVER'"
|
| jq '.builds[-1]')
|
||||||
|
case $? in
|
||||||
|
0)
|
||||||
|
;;
|
||||||
|
22)
|
||||||
|
versions=$(curl -fsSL "https://papermc.io/api/v2/projects/paper" -H "accept: application/json")
|
||||||
|
if [[ $VERSION = LATEST ]]; then
|
||||||
|
VANILLA_VERSION=$(echo "$versions" | jq -r '.versions[-1]')
|
||||||
|
log "WARN: using ${VANILLA_VERSION} since that's the latest provided by PaperMC"
|
||||||
|
# re-execute the current script with the newly computed version
|
||||||
|
exec $0 "$@"
|
||||||
|
fi
|
||||||
|
log "ERROR: ${VANILLA_VERSION} is not published by PaperMC"
|
||||||
|
log " Set VERSION to one of the following: "
|
||||||
|
log " $(echo "$versions" | jq -r '.versions | join(", ")')"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR: unknown error while looking up PaperMC version=${VANILLA_VERSION}"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
echo "ERROR: failed to lookup PaperMC build from version ${VANILLA_VERSION}"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
downloadUrl=${PAPER_DOWNLOAD_URL:-https://papermc.io/api/v1/paper/${VANILLA_VERSION}/${PAPERBUILD}/download}
|
export SERVER=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}" -H "accept: application/json" \
|
||||||
log "Downloading Paper $VANILLA_VERSION (build $PAPERBUILD) from $downloadUrl ..."
|
| jq -r '.downloads.application.name')
|
||||||
if ! curl -fsSL -o "$SERVER" $zarg "$downloadUrl"; then
|
if [ $? != 0 ]; then
|
||||||
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
echo "ERROR: failed to lookup PaperMC download file from version=${VANILLA_VERSION} build=${build}"
|
||||||
exit 3
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$SERVER" ]; then
|
||||||
|
zarg=(-z "$SERVER")
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Downloading PaperMC $VANILLA_VERSION (build $build) ..."
|
||||||
|
curl -fsSL -o "$SERVER" "${zarg[@]}" \
|
||||||
|
"https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}/downloads/${SERVER}" \
|
||||||
|
-H "accept: application/java-archive"
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
echo "ERROR: failed to download PaperMC from version=${VANILLA_VERSION} build=${build} download=${SERVER}"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Normalize on Spigot for downstream operations
|
# Normalize on Spigot for downstream operations
|
||||||
|
|||||||
@@ -18,42 +18,60 @@ fi
|
|||||||
|
|
||||||
# If supplied with a URL for a modpack (simple zip of jars), download it and unpack
|
# If supplied with a URL for a modpack (simple zip of jars), download it and unpack
|
||||||
if [[ "$MODPACK" ]]; then
|
if [[ "$MODPACK" ]]; then
|
||||||
EFFECTIVE_MODPACK_URL=$(curl -Ls -o /dev/null -w %{url_effective} $MODPACK)
|
if isURL "${MODPACK}"; then
|
||||||
case "X$EFFECTIVE_MODPACK_URL" in
|
if [[ "${MODPACK}" == *.zip ]]; then
|
||||||
X[Hh][Tt][Tt][Pp]*.zip)
|
downloadUrl="${MODPACK}"
|
||||||
|
else
|
||||||
|
downloadUrl=$(curl -Ls -o /dev/null -w %{url_effective} $MODPACK)
|
||||||
|
if ! [[ $downloadUrl == *.zip ]]; then
|
||||||
|
log "ERROR Invalid URL given for MODPACK: $downloadUrl resolved from $MODPACK"
|
||||||
|
log " Must be HTTP or HTTPS and a ZIP file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
log "Downloading mod/plugin pack via HTTP"
|
log "Downloading mod/plugin pack via HTTP"
|
||||||
log " from $EFFECTIVE_MODPACK_URL ..."
|
log " from $downloadUrl ..."
|
||||||
if ! curl -sSL -o /tmp/modpack.zip "$EFFECTIVE_MODPACK_URL"; then
|
if ! curl -sSL -o /tmp/modpack.zip "$downloadUrl"; then
|
||||||
log "ERROR: failed to download from $EFFECTIVE_MODPACK_URL"
|
log "ERROR: failed to download from $downloadUrl"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TYPE" = "SPIGOT" ]; then
|
if [ "$TYPE" = "SPIGOT" ]; then
|
||||||
mkdir -p /data/plugins
|
mkdir -p /data/plugins
|
||||||
if ! unzip -o -d /data/plugins /tmp/modpack.zip; then
|
if ! unzip -o -d /data/plugins /tmp/modpack.zip; then
|
||||||
log "ERROR: failed to unzip the modpack from $EFFECTIVE_MODPACK_URL"
|
log "ERROR: failed to unzip the modpack from $downloadUrl"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
mkdir -p /data/mods
|
mkdir -p /data/mods
|
||||||
if ! unzip -o -d /data/mods /tmp/modpack.zip; then
|
if ! unzip -o -d /data/mods /tmp/modpack.zip; then
|
||||||
log "ERROR: failed to unzip the modpack from $EFFECTIVE_MODPACK_URL"
|
log "ERROR: failed to unzip the modpack from $downloadUrl"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
rm -f /tmp/modpack.zip
|
rm -f /tmp/modpack.zip
|
||||||
;;
|
|
||||||
*)
|
else
|
||||||
log "Invalid URL given for modpack: Must be HTTP or HTTPS and a ZIP file"
|
log "ERROR Invalid URL given for MODPACK: $MODPACK"
|
||||||
;;
|
exit 1
|
||||||
esac
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If supplied with a URL for a plugin download it.
|
# If supplied with a URL for a plugin download it.
|
||||||
if [[ "$MODS" ]]; then
|
if [[ "$MODS" ]]; then
|
||||||
for i in ${MODS//,/ }
|
for i in ${MODS//,/ }
|
||||||
do
|
do
|
||||||
EFFECTIVE_MOD_URL=$(curl -Ls -o /dev/null -w %{url_effective} $i)
|
if isURL $i; then
|
||||||
case "X$EFFECTIVE_MOD_URL" in
|
if [[ $i == *.jar ]]; then
|
||||||
X[Hh][Tt][Tt][Pp]*.jar)
|
EFFECTIVE_MOD_URL=$i
|
||||||
|
else
|
||||||
|
EFFECTIVE_MOD_URL=$(curl -Ls -o /dev/null -w %{url_effective} $i)
|
||||||
|
if ! [[ $EFFECTIVE_MOD_URL == *.jar ]]; then
|
||||||
|
log "ERROR Invalid URL given in MODS: $EFFECTIVE_MOD_URL resolved from $i"
|
||||||
|
log " Must be HTTP or HTTPS and a JAR file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
log "Downloading mod/plugin via HTTP"
|
log "Downloading mod/plugin via HTTP"
|
||||||
log " from $EFFECTIVE_MOD_URL ..."
|
log " from $EFFECTIVE_MOD_URL ..."
|
||||||
if ! curl -sSL -o /tmp/${EFFECTIVE_MOD_URL##*/} $EFFECTIVE_MOD_URL; then
|
if ! curl -sSL -o /tmp/${EFFECTIVE_MOD_URL##*/} $EFFECTIVE_MOD_URL; then
|
||||||
@@ -69,12 +87,12 @@ do
|
|||||||
mv /tmp/${EFFECTIVE_MOD_URL##*/} /data/mods/${EFFECTIVE_MOD_URL##*/}
|
mv /tmp/${EFFECTIVE_MOD_URL##*/} /data/mods/${EFFECTIVE_MOD_URL##*/}
|
||||||
fi
|
fi
|
||||||
rm -f /tmp/${EFFECTIVE_MOD_URL##*/}
|
rm -f /tmp/${EFFECTIVE_MOD_URL##*/}
|
||||||
;;
|
|
||||||
*)
|
else
|
||||||
log "Invalid URL given for modpack: Must be HTTP or HTTPS and a JAR file"
|
log "ERROR Invalid URL given in MODS: $i"
|
||||||
;;
|
exit 1
|
||||||
esac
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$MANIFEST" ]]; then
|
if [[ "$MANIFEST" ]]; then
|
||||||
|
|||||||
@@ -54,7 +54,10 @@ done
|
|||||||
if [ -d /mods ]; then
|
if [ -d /mods ]; then
|
||||||
log "Copying any mods over..."
|
log "Copying any mods over..."
|
||||||
mkdir -p /data/mods
|
mkdir -p /data/mods
|
||||||
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /mods /data
|
if isTrue "${REMOVE_OLD_MODS}"; then
|
||||||
|
rsyncArgs=(--delete)
|
||||||
|
fi
|
||||||
|
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods /data
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -d /data/config ] || mkdir /data/config
|
[ -d /data/config ] || mkdir /data/config
|
||||||
@@ -173,7 +176,7 @@ function copyFilesForCurseForge() {
|
|||||||
cp -f /data/eula.txt "${FTB_DIR}/"
|
cp -f /data/eula.txt "${FTB_DIR}/"
|
||||||
}
|
}
|
||||||
|
|
||||||
mcServerRunnerArgs="--stop-duration 60s"
|
mcServerRunnerArgs="--stop-duration ${STOP_DURATION:-60}s"
|
||||||
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
||||||
if isTrue ${DEBUG_EXEC}; then
|
if isTrue ${DEBUG_EXEC}; then
|
||||||
set -x
|
set -x
|
||||||
|
|||||||
@@ -113,3 +113,12 @@ requireVar() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function writeEula() {
|
||||||
|
if ! echo "# Generated via Docker on $(date)
|
||||||
|
eula=${EULA,,}
|
||||||
|
" > /data/eula.txt; then
|
||||||
|
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user