mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-03-20 13:35:58 +00:00
Compare commits
38 Commits
1.4.0
...
1.5.0-mult
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c07f899870 | ||
|
|
092b530537 | ||
|
|
cf691499a1 | ||
|
|
0bb9cccdc6 | ||
|
|
4cb12f6cae | ||
|
|
ecbdeb2096 | ||
|
|
9a7a532f7b | ||
|
|
825833c859 | ||
|
|
c4c3613874 | ||
|
|
e527fd9551 | ||
|
|
3a03156cb3 | ||
|
|
047a477f7b | ||
|
|
78cb05adda | ||
|
|
8493252645 | ||
|
|
aa42633ab2 | ||
|
|
9ec336283f | ||
|
|
bbdb2c9b36 | ||
|
|
48e09f42fc | ||
|
|
ec7d182d38 | ||
|
|
9c7c95cf4f | ||
|
|
e32ffd1819 | ||
|
|
095c6ad099 | ||
|
|
14342c9632 | ||
|
|
f6df4d6694 | ||
|
|
0406e89c2a | ||
|
|
5ef21e1ddf | ||
|
|
414d5bd8ac | ||
|
|
15ccf03b28 | ||
|
|
828a48998f | ||
|
|
4b590e03ff | ||
|
|
0db8780ad9 | ||
|
|
5b744176df | ||
|
|
20b15e0330 | ||
|
|
818539e3de | ||
|
|
f48741f65c | ||
|
|
e9e5af849f | ||
|
|
22d68f5c7c | ||
|
|
690598da60 |
25
.github/workflows/build-multiarch.yml
vendored
Normal file
25
.github/workflows/build-multiarch.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
name: Build and publish multiarch
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- multiarch
|
||||||
|
tags:
|
||||||
|
- "[0-9]+.[0-9]+.[0-9]+-multiarch"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker-buildx:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2.2.0
|
||||||
|
- name: Get branch name
|
||||||
|
uses: nelonoel/branch-name@v1
|
||||||
|
- name: Docker Buildx
|
||||||
|
uses: ilteoood/docker_buildx@1.0.4
|
||||||
|
with:
|
||||||
|
publish: true
|
||||||
|
imageName: itzg/minecraft-server
|
||||||
|
tag: ${{ env.BRANCH_NAME }}
|
||||||
|
dockerHubUser: ${{ secrets.DOCKER_USER }}
|
||||||
|
dockerHubPassword: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
2
.github/workflows/pr.yml
vendored
2
.github/workflows/pr.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: PR validation
|
name: Validate PR
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|||||||
5
BUILDING.md
Normal file
5
BUILDING.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Ensure buildx/BuildKit support is enabled and run:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker buildx build --platform=linux/arm64 --platform=linux/arm/v7 --platform=linux/amd64 --tag itzg/minecraft-server:multiarch --push .
|
||||||
|
```
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
Adding a new server `TYPE` can vary due to the complexity of obtaining and configuring each type; however, the addition of any server type includes at least the following steps:
|
Adding a new server `TYPE` can vary due to the complexity of obtaining and configuring each type; however, the addition of any server type includes at least the following steps:
|
||||||
|
|
||||||
1. Copy an existing "start-deploy*" script, such as [start-deployMohist](start-deployMohist) and rename it accordingly making sure to retain the "start-deploy" prefix
|
1. Copy an existing "start-deploy*" script, such as [start-deployMohist](start-deployMohist) and rename it accordingly making sure to retain the "start-deploy" prefix
|
||||||
2. Modify the type-specific behavior between the "start-utils" preamble and the hand-off to `start-finalSetup01World` at the end of the script
|
2. Modify the type-specific behavior between the "start-utils" preamble and the hand-off to `start-finalSetupWorld` at the end of the script
|
||||||
3. Develop and test the changes using the [iterative process described below](#iterative-script-development)
|
3. Develop and test the changes using the [iterative process described below](#iterative-script-development)
|
||||||
4. Add a case-entry to the `case "${TYPE^^}"` in [start-configuration](start-configuration)
|
4. Add a case-entry to the `case "${TYPE^^}"` in [start-configuration](start-configuration)
|
||||||
5. Add a section to the [README](README.md). It is recommended to copy-modify an existing section to retain a similar wording and level of detail
|
5. Add a section to the [README](README.md). It is recommended to copy-modify an existing section to retain a similar wording and level of detail
|
||||||
@@ -70,5 +70,5 @@ The multiarch images are built and published by [a Github action](https://github
|
|||||||
The following git command can be used to provide the bulk of release notes content:
|
The following git command can be used to provide the bulk of release notes content:
|
||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
git log --invert-grep --grep "^ci:" --grep "^misc:" --pretty="- %s" 1.1.0..1.2.0
|
git log --invert-grep --grep "^ci:" --grep "^misc:" --grep "^docs:" --pretty="- %s" 1.1.0..1.2.0
|
||||||
```
|
```
|
||||||
|
|||||||
51
Dockerfile
51
Dockerfile
@@ -1,29 +1,27 @@
|
|||||||
FROM openjdk:8u212-jre-alpine
|
FROM ubuntu:18.04
|
||||||
|
|
||||||
LABEL maintainer "itzg"
|
LABEL maintainer "itzg"
|
||||||
|
|
||||||
RUN apk add --no-cache -U \
|
RUN apt-get update \
|
||||||
openssl \
|
&& DEBIAN_FRONTEND=noninteractive \
|
||||||
imagemagick \
|
apt-get install -y \
|
||||||
lsof \
|
openjdk-8-jre-headless \
|
||||||
su-exec \
|
imagemagick \
|
||||||
shadow \
|
gosu \
|
||||||
bash \
|
curl wget \
|
||||||
curl iputils wget \
|
jq \
|
||||||
git \
|
dos2unix \
|
||||||
jq \
|
mysql-client \
|
||||||
mysql-client \
|
tzdata \
|
||||||
tzdata \
|
rsync \
|
||||||
rsync \
|
nano \
|
||||||
nano \
|
unzip \
|
||||||
sudo \
|
knockd \
|
||||||
knock \
|
ttf-dejavu \
|
||||||
ttf-dejavu
|
&& apt-get clean
|
||||||
|
|
||||||
RUN addgroup -g 1000 minecraft \
|
RUN addgroup --gid 1000 minecraft \
|
||||||
&& adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \
|
&& adduser --system --shell /bin/false --uid 1000 --ingroup minecraft --home /data minecraft
|
||||||
&& mkdir -m 777 /data \
|
|
||||||
&& chown minecraft:minecraft /data /home/minecraft
|
|
||||||
|
|
||||||
COPY files/sudoers* /etc/sudoers.d
|
COPY files/sudoers* /etc/sudoers.d
|
||||||
|
|
||||||
@@ -31,9 +29,9 @@ EXPOSE 25565 25575
|
|||||||
|
|
||||||
# hook into docker BuildKit --platform support
|
# hook into docker BuildKit --platform support
|
||||||
# see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
|
# see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
|
||||||
ARG TARGETOS=linux
|
ARG TARGETOS
|
||||||
ARG TARGETARCH=amd64
|
ARG TARGETARCH
|
||||||
ARG TARGETVARIANT=""
|
ARG TARGETVARIANT
|
||||||
|
|
||||||
ARG EASY_ADD_VER=0.7.1
|
ARG EASY_ADD_VER=0.7.1
|
||||||
ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
|
ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
|
||||||
@@ -67,11 +65,10 @@ COPY log4j2.xml /tmp/log4j2.xml
|
|||||||
WORKDIR /data
|
WORKDIR /data
|
||||||
|
|
||||||
ENV UID=1000 GID=1000 \
|
ENV UID=1000 GID=1000 \
|
||||||
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
MEMORY="1G" \
|
||||||
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \
|
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \
|
||||||
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
||||||
LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
||||||
REPLACE_ENV_VARIABLES="FALSE" ENV_VARIABLE_PREFIX="CFG_" \
|
|
||||||
ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 AUTOPAUSE_PERIOD=10
|
ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 AUTOPAUSE_PERIOD=10
|
||||||
|
|
||||||
COPY start* /
|
COPY start* /
|
||||||
|
|||||||
97
README.md
97
README.md
@@ -176,6 +176,8 @@ You can also query the container's health in a script friendly way:
|
|||||||
healthy
|
healthy
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Some orchestration systems, such as Portainer, don't allow for disabling the default `HEALTHCHECK` declared by this image. In those cases you can approximate the disabling of healthchecks by setting the environment variable `DISABLE_HEALTHCHECK` to `true`.
|
||||||
|
|
||||||
## Autopause (experimental)
|
## Autopause (experimental)
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
@@ -306,7 +308,7 @@ defined environment variables. Variables that you want to replace need to be wra
|
|||||||
inside `${YOUR_VARIABLE}` curly brackets and prefixed with a dollar sign. This is the regular
|
inside `${YOUR_VARIABLE}` curly brackets and prefixed with a dollar sign. This is the regular
|
||||||
syntax for enviromment variables inside strings or config files.
|
syntax for enviromment variables inside strings or config files.
|
||||||
|
|
||||||
Optionally you can also define a prefix to only match predefined enviroment variables.
|
Optionally you can also define a prefix to only match predefined environment variables.
|
||||||
|
|
||||||
`ENV_VARIABLE_PREFIX="CFG_"` <-- this is the default prefix
|
`ENV_VARIABLE_PREFIX="CFG_"` <-- this is the default prefix
|
||||||
|
|
||||||
@@ -322,6 +324,8 @@ There are some limitations to what characters you can use.
|
|||||||
Variables will be replaced in files with the following extensions:
|
Variables will be replaced in files with the following extensions:
|
||||||
`.yml`, `.yaml`, `.txt`, `.cfg`, `.conf`, `.properties`.
|
`.yml`, `.yaml`, `.txt`, `.cfg`, `.conf`, `.properties`.
|
||||||
|
|
||||||
|
Specific files can be excluded by listing their name (without path) in the variable `REPLACE_ENV_VARIABLES_EXCLUDES`. Paths can be excluded by listing them in the variable `REPLACE_ENV_VARIABLES_EXCLUDE_PATHS`.
|
||||||
|
|
||||||
Here is a full example where we want to replace values inside a `database.yml`.
|
Here is a full example where we want to replace values inside a `database.yml`.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
@@ -396,45 +400,7 @@ If you are hosting your own copy of Bukkit/Spigot you can override the download
|
|||||||
|
|
||||||
You can build spigot from source by adding `-e BUILD_FROM_SOURCE=true`
|
You can build spigot from source by adding `-e BUILD_FROM_SOURCE=true`
|
||||||
|
|
||||||
You can install Bukkit plugins in two ways...
|
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.
|
||||||
|
|
||||||
### Using the /data volume
|
|
||||||
|
|
||||||
This is the easiest way if you are using a persistent `/data` mount.
|
|
||||||
|
|
||||||
To do this, you will need to attach the container's `/data` directory
|
|
||||||
(see "Attaching data directory to host filesystem”).
|
|
||||||
Then, you can add plugins to the `/path/on/host/plugins` folder you chose. From the example above,
|
|
||||||
the `/path/on/host` folder contents look like:
|
|
||||||
|
|
||||||
```
|
|
||||||
/path/on/host
|
|
||||||
├── plugins
|
|
||||||
│ └── ... INSTALL PLUGINS HERE ...
|
|
||||||
├── ops.json
|
|
||||||
├── server.properties
|
|
||||||
├── whitelist.json
|
|
||||||
└── ...
|
|
||||||
```
|
|
||||||
|
|
||||||
If you add plugins while the container is running, you'll need to restart it to pick those
|
|
||||||
up:
|
|
||||||
|
|
||||||
docker stop mc
|
|
||||||
docker start mc
|
|
||||||
|
|
||||||
### Using separate mounts
|
|
||||||
|
|
||||||
This is the easiest way if you are using an ephemeral `/data` filesystem,
|
|
||||||
or downloading a world with the `WORLD` option.
|
|
||||||
|
|
||||||
There is one additional volume that can be mounted; `/plugins`.
|
|
||||||
Any files in this filesystem will be copied over to the main
|
|
||||||
`/data/plugins` filesystem before starting Minecraft.
|
|
||||||
|
|
||||||
This works well if you want to have a common set of plugins in a separate
|
|
||||||
location, but still have multiple worlds with different server requirements
|
|
||||||
in either persistent volumes or a downloadable archive.
|
|
||||||
|
|
||||||
## Running a PaperSpigot server
|
## Running a PaperSpigot server
|
||||||
|
|
||||||
@@ -451,48 +417,10 @@ If you are hosting your own copy of PaperSpigot you can override the download UR
|
|||||||
|
|
||||||
- -e PAPER_DOWNLOAD_URL=<url>
|
- -e PAPER_DOWNLOAD_URL=<url>
|
||||||
|
|
||||||
You can install Bukkit plugins in two ways...
|
|
||||||
|
|
||||||
An example compose file is provided at
|
An example compose file is provided at
|
||||||
[examples/docker-compose-paper.yml](examples/docker-compose-paper.yml).
|
[examples/docker-compose-paper.yml](examples/docker-compose-paper.yml).
|
||||||
|
|
||||||
### Using the /data volume
|
If you have attached a host directory to the `/data` volume, then you can install plugins via 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.
|
||||||
|
|
||||||
This is the easiest way if you are using a persistent `/data` mount.
|
|
||||||
|
|
||||||
To do this, you will need to attach the container's `/data` directory
|
|
||||||
(see "Attaching data directory to host filesystem”).
|
|
||||||
Then, you can add plugins to the `/path/on/host/plugins` folder you chose. From the example above,
|
|
||||||
the `/path/on/host` folder contents look like:
|
|
||||||
|
|
||||||
```
|
|
||||||
/path/on/host
|
|
||||||
├── plugins
|
|
||||||
│ └── ... INSTALL PLUGINS HERE ...
|
|
||||||
├── ops.json
|
|
||||||
├── server.properties
|
|
||||||
├── whitelist.json
|
|
||||||
└── ...
|
|
||||||
```
|
|
||||||
|
|
||||||
If you add plugins while the container is running, you'll need to restart it to pick those
|
|
||||||
up:
|
|
||||||
|
|
||||||
docker stop mc
|
|
||||||
docker start mc
|
|
||||||
|
|
||||||
### Using separate mounts
|
|
||||||
|
|
||||||
This is the easiest way if you are using an ephemeral `/data` filesystem,
|
|
||||||
or downloading a world with the `WORLD` option.
|
|
||||||
|
|
||||||
There is one additional volume that can be mounted; `/plugins`.
|
|
||||||
Any files in this filesystem will be copied over to the main
|
|
||||||
`/data/plugins` filesystem before starting Minecraft.
|
|
||||||
|
|
||||||
This works well if you want to have a common set of plugins in a separate
|
|
||||||
location, but still have multiple worlds with different server requirements
|
|
||||||
in either persistent volumes or a downloadable archive.
|
|
||||||
|
|
||||||
## Running a Tuinity server
|
## Running a Tuinity server
|
||||||
|
|
||||||
@@ -670,6 +598,12 @@ 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.
|
||||||
|
|
||||||
|
## Deploying plugins from attached volume
|
||||||
|
|
||||||
|
There is one additional volume that can be mounted; `/plugins`. Any files in this filesystem will be copied over to the main `/data/plugins` filesystem before starting Minecraft. Set `PLUGINS_SYNC_UPDATE=false` if you want files from `/plugins` to take precedence over newer files in `/data/plugins`.
|
||||||
|
|
||||||
|
This works well if you want to have a common set of plugins in a separate location, but still have multiple worlds with different server requirements in either persistent volumes or a downloadable archive.
|
||||||
|
|
||||||
## Running with a custom server JAR
|
## Running with a custom server JAR
|
||||||
|
|
||||||
If you would like to run a custom server JAR, set `-e TYPE=CUSTOM` and pass the custom server
|
If you would like to run a custom server JAR, set `-e TYPE=CUSTOM` and pass the custom server
|
||||||
@@ -975,7 +909,7 @@ For example (just the `-e` bits):
|
|||||||
|
|
||||||
You can set a link to a custom resource pack and set it's checksum using the `RESOURCE_PACK` and `RESOURCE_PACK_SHA1` options respectively, the default is blank:
|
You can set a link to a custom resource pack and set it's checksum using the `RESOURCE_PACK` and `RESOURCE_PACK_SHA1` options respectively, the default is blank:
|
||||||
|
|
||||||
docker run -d -e 'RESROUCE_PACK=http\://link.com/to/pack.zip?\=1' -e 'RESOURCE_PACK_SHA1=d5db29cd03a2ed055086cef9c31c252b4587d6d0'
|
docker run -d -e 'RESOURCE_PACK=http\://link.com/to/pack.zip?\=1' -e 'RESOURCE_PACK_SHA1=d5db29cd03a2ed055086cef9c31c252b4587d6d0'
|
||||||
|
|
||||||
**NOTE:** `:` and `=` must be escaped using `\`. The checksum plain-text hexadecimal.
|
**NOTE:** `:` and `=` must be escaped using `\`. The checksum plain-text hexadecimal.
|
||||||
|
|
||||||
@@ -1013,6 +947,9 @@ read-only volume attachment to ensure the clone source remains pristine.
|
|||||||
docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic
|
docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Overwrite world on start
|
||||||
|
The world will only be downloaded or copied if it doesn't exist already. Set `FORCE_WORLD_COPY=TRUE` to force overwrite the world on every server start.
|
||||||
|
|
||||||
### Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers
|
### Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers
|
||||||
|
|
||||||
Like the `WORLD` option above, you can specify the URL of a "mod pack"
|
Like the `WORLD` option above, you can specify the URL of a "mod pack"
|
||||||
|
|||||||
0
docs/.gitkeep
Normal file
0
docs/.gitkeep
Normal file
@@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
if isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then
|
if isTrue "${DISABLE_HEALTHCHECK}"; then
|
||||||
|
echo "Healthcheck disabled"
|
||||||
|
exit 0
|
||||||
|
elif isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then
|
||||||
echo "Java process suspended by Autopause function"
|
echo "Java process suspended by Autopause function"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
|
|||||||
2
start
2
start
@@ -45,7 +45,7 @@ if [ $(id -u) = 0 ]; then
|
|||||||
echo 'hosts: files dns' > /etc/nsswitch.conf
|
echo 'hosts: files dns' > /etc/nsswitch.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec su-exec ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
|
exec gosu ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
|
||||||
else
|
else
|
||||||
exec ${SCRIPTS:-/}start-configuration $@
|
exec ${SCRIPTS:-/}start-configuration $@
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ shopt -s nullglob
|
|||||||
#umask 002
|
#umask 002
|
||||||
export HOME=/data
|
export HOME=/data
|
||||||
|
|
||||||
|
log "Running as uid=$(id -u) gid=$(id -g) with /data as '$(ls -lnd /data)'"
|
||||||
|
|
||||||
if [ ! -e /data/eula.txt ]; then
|
if [ ! -e /data/eula.txt ]; then
|
||||||
EULA="${EULA,,}"
|
EULA="${EULA,,}"
|
||||||
if [ "$EULA" != "true" ]; then
|
if [ "$EULA" != "true" ]; then
|
||||||
@@ -28,15 +30,6 @@ if [ ! -e /data/eula.txt ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
log "Running as uid=$(id -u) gid=$(id -g) with /data as '$(ls -lnd /data)'"
|
|
||||||
|
|
||||||
if ! touch /data/.verify_access; then
|
|
||||||
log "ERROR: /data doesn't seem to be writable. Please make sure attached directory is writable by uid=$(id -u)"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm /data/.verify_access || true
|
|
||||||
|
|
||||||
if [[ $PROXY ]]; then
|
if [[ $PROXY ]]; then
|
||||||
export http_proxy="$PROXY"
|
export http_proxy="$PROXY"
|
||||||
export https_proxy="$PROXY"
|
export https_proxy="$PROXY"
|
||||||
@@ -95,10 +88,14 @@ case "${TYPE^^}" in
|
|||||||
exec ${SCRIPTS:-/}start-deployFabric "$@"
|
exec ${SCRIPTS:-/}start-deployFabric "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
FTB|CURSEFORGE)
|
FTBA)
|
||||||
exec ${SCRIPTS:-/}start-deployFTB "$@"
|
exec ${SCRIPTS:-/}start-deployFTB "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
CURSEFORGE|FTB)
|
||||||
|
exec ${SCRIPTS:-/}start-deployCF "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
VANILLA)
|
VANILLA)
|
||||||
exec ${SCRIPTS:-/}start-deployVanilla "$@"
|
exec ${SCRIPTS:-/}start-deployVanilla "$@"
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -102,4 +102,4 @@ export TYPE=SPIGOT
|
|||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
133
start-deployCF
Normal file
133
start-deployCF
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. /start-utils
|
||||||
|
|
||||||
|
export FTB_BASE_DIR=/data/FeedTheBeast
|
||||||
|
legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
|
||||||
|
export TYPE=CURSEFORGE
|
||||||
|
|
||||||
|
FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD}
|
||||||
|
|
||||||
|
log "Looking for CurseForge server modpack."
|
||||||
|
if [[ -z $FTB_SERVER_MOD ]]; then
|
||||||
|
log "Environment variable FTB_SERVER_MOD not set."
|
||||||
|
log "Set FTB_SERVER_MOD to the file name of the FTB server modpack."
|
||||||
|
log "(And place the modpack in the /data directory.)"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
entryScriptExpr="-name ServerStart.sh -o -name ServerStartLinux.sh -o -name LaunchServer.sh"
|
||||||
|
|
||||||
|
if [[ -d ${FTB_BASE_DIR} ]]; then
|
||||||
|
startScriptCount=$(find ${FTB_BASE_DIR} $entryScriptExpr |wc -l)
|
||||||
|
if [[ $startScriptCount > 1 ]]; then
|
||||||
|
log "Conflicting FTB/CurseForge packages have been installed. Please cleanup ${FTB_BASE_DIR}"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
startScriptCount=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# only download and install if a mod pack isn't already installed
|
||||||
|
# also check for the start script rather than just the folder
|
||||||
|
# this allows saving just the world separate from the rest of the data directory
|
||||||
|
if [[ $startScriptCount = 0 ]]; then
|
||||||
|
srv_modpack=${FTB_SERVER_MOD}
|
||||||
|
if isURL ${srv_modpack}; then
|
||||||
|
case $srv_modpack in
|
||||||
|
https://www.feed-the-beast.com/*/download|https://www.curseforge.com/minecraft/modpacks/*/download/*/file)
|
||||||
|
;;
|
||||||
|
https://www.curseforge.com/minecraft/modpacks/*/download/*)
|
||||||
|
srv_modpack=${srv_modpack}/file;;
|
||||||
|
https://www.feed-the-beast.com/*)
|
||||||
|
srv_modpack=${srv_modpack}/download;;
|
||||||
|
esac
|
||||||
|
file=$(basename $(dirname $srv_modpack))
|
||||||
|
downloaded=/data/${file}.zip
|
||||||
|
if [ ! -e $downloaded ]; then
|
||||||
|
log "Downloading FTB modpack...
|
||||||
|
$srv_modpack -> $downloaded"
|
||||||
|
curl -sSL -o $downloaded $srv_modpack
|
||||||
|
fi
|
||||||
|
srv_modpack=$downloaded
|
||||||
|
fi
|
||||||
|
if [[ ${srv_modpack:0:5} == "data/" ]]; then
|
||||||
|
# Prepend with "/"
|
||||||
|
srv_modpack=/${srv_modpack}
|
||||||
|
fi
|
||||||
|
if [[ ! ${srv_modpack:0:1} == "/" ]]; then
|
||||||
|
# If not an absolute path, assume file is in "/data"
|
||||||
|
srv_modpack=/data/${srv_modpack}
|
||||||
|
fi
|
||||||
|
if [[ ! -f ${srv_modpack} ]]; then
|
||||||
|
log "FTB server modpack ${srv_modpack} not found."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
if [[ ! ${srv_modpack: -4} == ".zip" ]]; then
|
||||||
|
log "FTB server modpack ${srv_modpack} is not a zip archive."
|
||||||
|
log "Please set FTB_SERVER_MOD to a file with a .zip extension."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Unpacking FTB server modpack ${srv_modpack} ..."
|
||||||
|
mkdir -p ${FTB_BASE_DIR}
|
||||||
|
unzip -o ${srv_modpack} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then
|
||||||
|
|
||||||
|
# Allow up to 2 levels since some modpacks have a top-level directory named
|
||||||
|
# for the modpack
|
||||||
|
forgeJar=$(find ${FTB_BASE_DIR} -maxdepth 2 -name 'forge*.jar' -a -not -name 'forge*installer')
|
||||||
|
if [[ "$forgeJar" ]]; then
|
||||||
|
export FTB_BASE_DIR=$(dirname "${forgeJar}")
|
||||||
|
log "No entry script found, so building one for ${forgeJar}"
|
||||||
|
cat > "${FTB_BASE_DIR}/ServerStart.sh" <<EOF
|
||||||
|
#!/bin/sh
|
||||||
|
. ./settings-local.sh
|
||||||
|
java \${JAVA_PARAMETERS} -Xmx\${MAX_RAM} -jar $(basename "${forgeJar}") nogui
|
||||||
|
EOF
|
||||||
|
chmod +x "${FTB_BASE_DIR}/ServerStart.sh"
|
||||||
|
else
|
||||||
|
log "Please make sure you are using the server version of the FTB modpack!"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
scriptCount=$(find "${FTB_BASE_DIR}" $entryScriptExpr | wc -l)
|
||||||
|
if [[ $scriptCount = 0 ]]; then
|
||||||
|
log "Please make sure you are using the server version of the FTB modpack!"
|
||||||
|
exit 2
|
||||||
|
elif [[ $scriptCount > 1 ]]; then
|
||||||
|
log "Ambigous startup scripts in FTB modpack!"
|
||||||
|
log "found:"
|
||||||
|
find ${FTB_BASE_DIR} $entryScriptExpr
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
export FTB_SERVER_START=$(find "${FTB_BASE_DIR}" $entryScriptExpr)
|
||||||
|
|
||||||
|
export FTB_DIR=$(dirname "${FTB_SERVER_START}")
|
||||||
|
chmod a+x "${FTB_SERVER_START}"
|
||||||
|
grep fml.queryResult=confirm ${FTB_SERVER_START} > /dev/null || \
|
||||||
|
sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' "${FTB_SERVER_START}"
|
||||||
|
sed -i 's/.*read.*Restart now/#\0/' "${FTB_SERVER_START}"
|
||||||
|
legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar"
|
||||||
|
|
||||||
|
if isTrue ${FTB_LEGACYJAVAFIXER} && [ ! -e "${legacyJavaFixerPath}" ]; then
|
||||||
|
log "Installing legacy java fixer to ${legacyJavaFixerPath}"
|
||||||
|
curl -sSL -o "${legacyJavaFixerPath}" ${legacyJavaFixerUrl}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "${FTB_DIR}/FTBInstall.sh" ]; then
|
||||||
|
pushd "${FTB_DIR}"
|
||||||
|
sh FTBInstall.sh
|
||||||
|
popd
|
||||||
|
elif [ -e "${FTB_DIR}/Install.sh" ]; then
|
||||||
|
pushd "${FTB_DIR}"
|
||||||
|
sh Install.sh
|
||||||
|
popd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Continue to Final Setup
|
||||||
|
exec /start-finalSetup01World $@
|
||||||
@@ -29,4 +29,4 @@ fi
|
|||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World "$@"
|
exec ${SCRIPTS:-/}start-finalSetupWorld "$@"
|
||||||
|
|||||||
@@ -28,4 +28,4 @@ fi
|
|||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
178
start-deployFTB
178
start-deployFTB
@@ -1,138 +1,70 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
ftbInstallMarker=".ftb-installed"
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
isDebugging && set -x
|
||||||
|
set -e
|
||||||
|
|
||||||
export FTB_BASE_DIR=/data/FeedTheBeast
|
if ! [[ -v FTB_MODPACK_ID ]]; then
|
||||||
legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
|
log "ERROR FTB_MODPACK_ID is required with TYPE=FTB"
|
||||||
export TYPE=FEED-THE-BEAST
|
exit 1
|
||||||
|
|
||||||
FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD}
|
|
||||||
|
|
||||||
log "Looking for Feed-The-Beast / CurseForge server modpack."
|
|
||||||
if [[ -z $FTB_SERVER_MOD ]]; then
|
|
||||||
log "Environment variable FTB_SERVER_MOD not set."
|
|
||||||
log "Set FTB_SERVER_MOD to the file name of the FTB server modpack."
|
|
||||||
log "(And place the modpack in the /data directory.)"
|
|
||||||
exit 2
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
entryScriptExpr="
|
if ! [[ ${FTB_MODPACK_ID} =~ [0-9]+ ]]; then
|
||||||
-name ServerStart.sh
|
log "ERROR FTB_MODPACK_ID needs to be numeric"
|
||||||
-o -name ServerStartLinux.sh
|
exit 1
|
||||||
-o -name LaunchServer.sh
|
fi
|
||||||
-o -name server-start.sh
|
|
||||||
"
|
|
||||||
|
|
||||||
if [[ -d ${FTB_BASE_DIR} ]]; then
|
if ! [[ -v FTB_MODPACK_VERSION_ID ]]; then
|
||||||
startScriptCount=$(find ${FTB_BASE_DIR} $entryScriptExpr |wc -l)
|
if ! FTB_MODPACK_VERSION_ID=$(curl -fsSL https://api.modpacks.ch/public/modpack/${FTB_MODPACK_ID} | jq -r '.versions | sort_by(.updated)[-1].id'); then
|
||||||
if [[ $startScriptCount > 1 ]]; then
|
log "ERROR unable to resolve latest modpack version ID for modpack ${FTB_MODPACK_ID}"
|
||||||
log "Conflicting FTB/CurseForge packages have been installed. Please cleanup ${FTB_BASE_DIR}"
|
exit 1
|
||||||
exit 2
|
|
||||||
fi
|
fi
|
||||||
|
elif ! [[ ${FTB_MODPACK_VERSION_ID} =~ [0-9]+ ]]; then
|
||||||
|
log "ERROR FTB_MODPACK_VERSION_ID needs to be numeric"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -f "${ftbInstallMarker}" ] || [ $(cat "${ftbInstallMarker}") != "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" ]; then
|
||||||
|
ftbInstaller=/data/ftb-installer
|
||||||
|
if ! [[ -f "${ftbInstaller}" ]]; then
|
||||||
|
log "Downloading FTB installer"
|
||||||
|
curl -fsSL https://api.modpacks.ch/public/modpack/1/1/server/linux -o "${ftbInstaller}"
|
||||||
|
chmod +x "${ftbInstaller}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -rf forge*jar mods config libraries defaultconfigs changelogs
|
||||||
|
|
||||||
|
log "Installing modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID}"
|
||||||
|
${ftbInstaller} ${FTB_MODPACK_ID} ${FTB_MODPACK_VERSION_ID} --noscript --auto
|
||||||
|
rm -f forge*installer.jar
|
||||||
|
|
||||||
|
echo "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" > ${ftbInstallMarker}
|
||||||
else
|
else
|
||||||
startScriptCount=0
|
log "FTB modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID} is ready to go"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# only download and install if a mod pack isn't already installed
|
isDebugging && cat version.json
|
||||||
# also check for the start script rather than just the folder
|
forgeVersion=$(jq -r '.targets[] | select(.name == "forge") | .version' version.json)
|
||||||
# this allows saving just the world separate from the rest of the data directory
|
mcVersion=$(jq -r '.targets[] | select(.name == "minecraft") | .version' version.json)
|
||||||
if [[ $startScriptCount = 0 ]]; then
|
|
||||||
srv_modpack=${FTB_SERVER_MOD}
|
variants=(
|
||||||
if isURL ${srv_modpack}; then
|
forge-${mcVersion}-${forgeVersion}.jar
|
||||||
case $srv_modpack in
|
forge-${mcVersion}-${forgeVersion}-universal.jar
|
||||||
https://www.feed-the-beast.com/*/download|https://www.curseforge.com/minecraft/modpacks/*/download/*/file)
|
forge-${mcVersion}-${forgeVersion}-${mcVersion}-universal.jar
|
||||||
;;
|
)
|
||||||
https://www.curseforge.com/minecraft/modpacks/*/download/*)
|
for f in ${variants[@]}; do
|
||||||
srv_modpack=${srv_modpack}/file;;
|
if [ -f $f ]; then
|
||||||
https://www.feed-the-beast.com/*)
|
export SERVER=$f
|
||||||
srv_modpack=${srv_modpack}/download;;
|
break
|
||||||
esac
|
|
||||||
file=$(basename $(dirname $srv_modpack))
|
|
||||||
downloaded=/data/${file}.zip
|
|
||||||
if [ ! -e $downloaded ]; then
|
|
||||||
log "Downloading FTB modpack...
|
|
||||||
$srv_modpack -> $downloaded"
|
|
||||||
curl -sSL -o $downloaded $srv_modpack
|
|
||||||
fi
|
|
||||||
srv_modpack=$downloaded
|
|
||||||
fi
|
fi
|
||||||
if [[ ${srv_modpack:0:5} == "data/" ]]; then
|
done
|
||||||
# Prepend with "/"
|
if ! [ -v SERVER ]; then
|
||||||
srv_modpack=/${srv_modpack}
|
log "ERROR unable to locate the installed forge server jar"
|
||||||
fi
|
ls *.jar
|
||||||
if [[ ! ${srv_modpack:0:1} == "/" ]]; then
|
exit 2
|
||||||
# If not an absolute path, assume file is in "/data"
|
|
||||||
srv_modpack=/data/${srv_modpack}
|
|
||||||
fi
|
|
||||||
if [[ ! -f ${srv_modpack} ]]; then
|
|
||||||
log "FTB server modpack ${srv_modpack} not found."
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
if [[ ! ${srv_modpack: -4} == ".zip" ]]; then
|
|
||||||
log "FTB server modpack ${srv_modpack} is not a zip archive."
|
|
||||||
log "Please set FTB_SERVER_MOD to a file with a .zip extension."
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
log "Unpacking FTB server modpack ${srv_modpack} ..."
|
|
||||||
mkdir -p ${FTB_BASE_DIR}
|
|
||||||
unzip -o ${srv_modpack} -d ${FTB_BASE_DIR} | awk '{printf "."} END {print ""}'
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then
|
|
||||||
|
|
||||||
# Allow up to 2 levels since some modpacks have a top-level directory named
|
|
||||||
# for the modpack
|
|
||||||
forgeJar=$(find ${FTB_BASE_DIR} -maxdepth 2 -name 'forge*.jar' -a -not -name 'forge*installer')
|
|
||||||
if [[ "$forgeJar" ]]; then
|
|
||||||
export FTB_BASE_DIR=$(dirname "${forgeJar}")
|
|
||||||
log "No entry script found, so building one for ${forgeJar}"
|
|
||||||
cat > "${FTB_BASE_DIR}/ServerStart.sh" <<EOF
|
|
||||||
#!/bin/sh
|
|
||||||
. ./settings-local.sh
|
|
||||||
java \${JAVA_PARAMETERS} -Xmx\${MAX_RAM} -jar $(basename "${forgeJar}") nogui
|
|
||||||
EOF
|
|
||||||
chmod +x "${FTB_BASE_DIR}/ServerStart.sh"
|
|
||||||
else
|
|
||||||
log "Please make sure you are using the server version of the FTB modpack!"
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
scriptCount=$(find "${FTB_BASE_DIR}" $entryScriptExpr | wc -l)
|
|
||||||
if [[ $scriptCount = 0 ]]; then
|
|
||||||
log "Please make sure you are using the server version of the FTB modpack!"
|
|
||||||
exit 2
|
|
||||||
elif [[ $scriptCount > 1 ]]; then
|
|
||||||
log "Ambigous startup scripts in FTB modpack!"
|
|
||||||
log "found:"
|
|
||||||
find ${FTB_BASE_DIR} $entryScriptExpr
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
export FTB_SERVER_START=$(find "${FTB_BASE_DIR}" $entryScriptExpr)
|
|
||||||
|
|
||||||
export FTB_DIR=$(dirname "${FTB_SERVER_START}")
|
|
||||||
chmod a+x "${FTB_SERVER_START}"
|
|
||||||
grep fml.queryResult=confirm ${FTB_SERVER_START} > /dev/null || \
|
|
||||||
sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' "${FTB_SERVER_START}"
|
|
||||||
sed -i 's/.*read.*Restart now/#\0/' "${FTB_SERVER_START}"
|
|
||||||
legacyJavaFixerPath="${FTB_DIR}/mods/legacyjavafixer.jar"
|
|
||||||
|
|
||||||
if isTrue ${FTB_LEGACYJAVAFIXER} && [ ! -e "${legacyJavaFixerPath}" ]; then
|
|
||||||
log "Installing legacy java fixer to ${legacyJavaFixerPath}"
|
|
||||||
curl -sSL -o "${legacyJavaFixerPath}" ${legacyJavaFixerUrl}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e "${FTB_DIR}/FTBInstall.sh" ]; then
|
|
||||||
pushd "${FTB_DIR}"
|
|
||||||
sh FTBInstall.sh
|
|
||||||
popd
|
|
||||||
elif [ -e "${FTB_DIR}/Install.sh" ]; then
|
|
||||||
pushd "${FTB_DIR}"
|
|
||||||
sh Install.sh
|
|
||||||
popd
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -75,4 +75,4 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Contineut to Final Setup
|
# Contineut to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -113,4 +113,4 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ fi
|
|||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -40,4 +40,4 @@ fi
|
|||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World "$@"
|
exec ${SCRIPTS:-/}start-finalSetupWorld "$@"
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ export TYPE=SPIGOT
|
|||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -36,4 +36,4 @@ if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ fi
|
|||||||
export TYPE=SPIGOT
|
export TYPE=SPIGOT
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -43,4 +43,4 @@ fi
|
|||||||
isDebugging && ls -l
|
isDebugging && ls -l
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
|
|||||||
@@ -2,8 +2,20 @@
|
|||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
|
: ${ENV_VARIABLE_PREFIX:=CFG_}
|
||||||
|
|
||||||
|
if isTrue "${REPLACE_ENV_VARIABLES}"; then
|
||||||
log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..."
|
log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..."
|
||||||
|
|
||||||
|
findExcludes=
|
||||||
|
for f in ${REPLACE_ENV_VARIABLES_EXCLUDES}; do
|
||||||
|
findExcludes="${findExcludes} -not -name $f"
|
||||||
|
done
|
||||||
|
for p in ${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS}; do
|
||||||
|
findExcludes="${findExcludes} -not -path \"*$p*\""
|
||||||
|
done
|
||||||
|
isDebugging && echo "Using find exclusion: $findExcludes"
|
||||||
|
|
||||||
while IFS='=' read -r name value ; do
|
while IFS='=' read -r name value ; do
|
||||||
# check if name of env variable matches the prefix
|
# check if name of env variable matches the prefix
|
||||||
# sanity check environment variables to avoid code injections
|
# sanity check environment variables to avoid code injections
|
||||||
@@ -20,6 +32,7 @@ if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
|
|||||||
find /data/ -type f \
|
find /data/ -type f \
|
||||||
\( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \
|
\( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \
|
||||||
-or -name "*.conf" -or -name "*.properties" \) \
|
-or -name "*.conf" -or -name "*.properties" \) \
|
||||||
|
$findExcludes \
|
||||||
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
|
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
|
||||||
fi
|
fi
|
||||||
done < <(env)
|
done < <(env)
|
||||||
@@ -24,4 +24,4 @@ case "X$MODCONFIG" in
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-finalSetup04ServerProperties $@
|
exec ${SCRIPTS:-/}start-finalSetupPlugins $@
|
||||||
@@ -154,4 +154,4 @@ if [[ "${GENERIC_PACK}" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-finalSetup03Modconfig $@
|
exec ${SCRIPTS:-/}start-finalSetupModconfig $@
|
||||||
23
start-finalSetupPlugins
Executable file
23
start-finalSetupPlugins
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
|
: ${PLUGINS_SYNC_UPDATE:=true}
|
||||||
|
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
|
if [ -d /plugins ]; then
|
||||||
|
case ${TYPE} in
|
||||||
|
SPIGOT|BUKKIT|PAPER)
|
||||||
|
mkdir -p /data/plugins
|
||||||
|
log "Copying plugins over..."
|
||||||
|
if isTrue ${PLUGINS_SYNC_UPDATE}; then
|
||||||
|
updateArg="--update"
|
||||||
|
fi
|
||||||
|
# Copy plugins over using rsync to allow deeply nested updates of plugins
|
||||||
|
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs $updateArg /plugins /data
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec ${SCRIPTS:-/}start-finalSetupServerProperties $@
|
||||||
@@ -206,4 +206,4 @@ if isDebugging; then
|
|||||||
cat /data/server.properties
|
cat /data/server.properties
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-finalSetup05EnvVariables $@
|
exec ${SCRIPTS:-/}start-finalSetupEnvVariables $@
|
||||||
@@ -10,7 +10,7 @@ else
|
|||||||
worldDest=/data/$LEVEL
|
worldDest=/data/$LEVEL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then
|
if [[ "$WORLD" ]] && isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ]; then
|
||||||
if isURL $WORLD; then
|
if isURL $WORLD; then
|
||||||
curl -fsSL "$WORLD" -o /tmp/world.zip
|
curl -fsSL "$WORLD" -o /tmp/world.zip
|
||||||
zipSrc=/tmp/world.zip
|
zipSrc=/tmp/world.zip
|
||||||
@@ -37,10 +37,10 @@ if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then
|
|||||||
log "ERROR invalid world content"
|
log "ERROR invalid world content"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
mv "$baseDir" "$worldDest"
|
rsync --remove-source-files --recursive --delete "$baseDir/" "$worldDest"
|
||||||
else
|
else
|
||||||
log "Cloning world directory from $WORLD ..."
|
log "Cloning world directory from $WORLD ..."
|
||||||
cp -r "$WORLD" "$worldDest"
|
rsync --recursive --delete "${WORLD%/}"/ "$worldDest"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TYPE" = "SPIGOT" ]; then
|
if [ "$TYPE" = "SPIGOT" ]; then
|
||||||
@@ -51,4 +51,4 @@ if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-finalSetup02Modpack $@
|
exec ${SCRIPTS:-/}start-finalSetupModpack $@
|
||||||
@@ -66,18 +66,6 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
case ${TYPE} in
|
|
||||||
SPIGOT|BUKKIT|PAPER)
|
|
||||||
mkdir -p /data/plugins
|
|
||||||
if [ -d /plugins ]; then
|
|
||||||
log "Copying plugins over..."
|
|
||||||
# Copy plugins over using rsync to allow deeply nested updates of plugins
|
|
||||||
# only updates files if the source file is newer and print updated files
|
|
||||||
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /plugins /data
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
EXTRA_ARGS=""
|
EXTRA_ARGS=""
|
||||||
# Optional disable console
|
# Optional disable console
|
||||||
if versionLessThan 1.14 && [[ ${CONSOLE,,} = false ]]; then
|
if versionLessThan 1.14 && [[ ${CONSOLE,,} = false ]]; then
|
||||||
@@ -179,7 +167,7 @@ if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
|||||||
exec mc-server-runner ${mcServerRunnerArgs} \
|
exec mc-server-runner ${mcServerRunnerArgs} \
|
||||||
--cf-instance-file "${CURSE_INSTANCE_JSON}" \
|
--cf-instance-file "${CURSE_INSTANCE_JSON}" \
|
||||||
java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar _SERVERJAR_ "$@" $EXTRA_ARGS
|
java $JVM_XX_OPTS $JVM_OPTS $expandedDOpts -jar _SERVERJAR_ "$@" $EXTRA_ARGS
|
||||||
elif [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
|
elif [[ ${TYPE} == "CURSEFORGE" ]]; then
|
||||||
mcServerRunnerArgs="${mcServerRunnerArgs} --shell bash"
|
mcServerRunnerArgs="${mcServerRunnerArgs} --shell bash"
|
||||||
|
|
||||||
if [ ! -e "${FTB_DIR}/ops.json" -a -e /data/ops.txt ]; then
|
if [ ! -e "${FTB_DIR}/ops.json" -a -e /data/ops.txt ]; then
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ fi
|
|||||||
log "Resolved CURSE_INSTANCE_JSON as ${CURSE_INSTANCE_JSON}"
|
log "Resolved CURSE_INSTANCE_JSON as ${CURSE_INSTANCE_JSON}"
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetup01World "$@"
|
exec ${SCRIPTS:-/}start-finalSetupWorld "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user