mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-03-30 02:12:45 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca9f883352 | ||
|
|
9d68fa3b88 | ||
|
|
d3a5885d95 | ||
|
|
c1db13c1f6 | ||
|
|
31b0f711b8 | ||
|
|
59ca1ce3a6 | ||
|
|
0f7bd5f4fd |
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -9,6 +9,7 @@ on:
|
|||||||
- adopt11
|
- adopt11
|
||||||
- adopt13
|
- adopt13
|
||||||
- adopt14
|
- adopt14
|
||||||
|
- adopt15
|
||||||
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"
|
||||||
@@ -16,6 +17,7 @@ on:
|
|||||||
- "[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"
|
- "[0-9]+.[0-9]+.[0-9]+-adopt14"
|
||||||
|
- "[0-9]+.[0-9]+.[0-9]+-adopt15"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
|||||||
@@ -301,13 +301,17 @@ 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. If you want old mods to be removed as the `/mods` content is updated, then add `-e REMOVE_OLD_MODS=TRUE`.
|
`/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`. If you are running a `BUKKIT` distribution this will affect all files inside the `plugins/` directory. You can fine tune the removal process by specifing the `REMOVE_OLD_MODS_INCLUDE` and `REMOVE_OLD_MODS_EXCLUDE` variables. By default everything will be removed. You can also specify the `REMOVE_OLD_MODS_DEPTH` (default 16) variable to only delete files up to a certain level.
|
||||||
|
|
||||||
|
> For example: `-e REMOVE_OLD_MODS=TRUE -e REMOVE_OLD_MODS_INCLUDE="*.jar" -e REMOVE_OLD_MODS_DEPTH=1` will remove all old jar files that are directly inside the `plugins/` or `mods/` directory.
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
You can specify the destination of the configs that are located inside the `/config` mount by setting the `COPY_CONFIG_DEST` variable. The configs are copied recursivly to the `/data/config` directory by default. If a file was updated directly inside the `/data/*` directoy and is newer than the file in the `/config/*` mount it will not be overriden.
|
||||||
|
|
||||||
|
> For example: `-v ./config:/config -e COPY_CONFIG_DEST=/data` will allow you to copy over your `bukkit.yml` and so on directly into the server directory.
|
||||||
|
|
||||||
### Replacing variables inside configs
|
### Replacing variables inside configs
|
||||||
|
|
||||||
|
|||||||
@@ -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' 'adopt14' 'multiarch' 'multiarch-latest')
|
branches_list=('openj9' 'openj9-nightly' 'adopt11' 'adopt13' 'adopt14' 'adopt15' 'multiarch' 'multiarch-latest')
|
||||||
|
|
||||||
function TrapExit {
|
function TrapExit {
|
||||||
echo "Checking out back in master"
|
echo "Checking out back in master"
|
||||||
|
|||||||
@@ -1,19 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e -o pipefail
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
if isDebugging; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
# CURSE_URL_BASE used in manifest downloads below
|
# CURSE_URL_BASE used in manifest downloads below
|
||||||
CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects}
|
CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects}
|
||||||
|
|
||||||
# Remove old mods/plugins
|
# Remove old mods/plugins
|
||||||
if [ "$REMOVE_OLD_MODS" = "TRUE" ]; then
|
if isTrue ${REMOVE_OLD_MODS}; then
|
||||||
if [ "$TYPE" = "SPIGOT" ]; then
|
remove_mods_dest="/data/mods"
|
||||||
rm -rf /data/plugins/*
|
case ${TYPE} in
|
||||||
else
|
SPIGOT|BUKKIT|PAPER)
|
||||||
rm -rf /data/mods/*
|
remove_mods_dest="/data/plugins"
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
log "Removing old mods in $remove_mods_dest..."
|
||||||
|
find $remove_mods_dest -mindepth 1 -maxdepth ${REMOVE_OLD_MODS_DEPTH:-16} -wholename "${REMOVE_OLD_MODS_INCLUDE:-*}" -not -wholename "${REMOVE_OLD_MODS_EXCLUDE}" -delete
|
||||||
fi
|
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
|
||||||
@@ -22,7 +29,7 @@ if [[ "$MODPACK" ]]; then
|
|||||||
if [[ "${MODPACK}" == *.zip ]]; then
|
if [[ "${MODPACK}" == *.zip ]]; then
|
||||||
downloadUrl="${MODPACK}"
|
downloadUrl="${MODPACK}"
|
||||||
else
|
else
|
||||||
downloadUrl=$(curl -Ls -o /dev/null -w %{url_effective} $MODPACK)
|
downloadUrl=$(curl -Ls -o /dev/null -w %{effective_url} $MODPACK)
|
||||||
if ! [[ $downloadUrl == *.zip ]]; then
|
if ! [[ $downloadUrl == *.zip ]]; then
|
||||||
log "ERROR Invalid URL given for MODPACK: $downloadUrl resolved from $MODPACK"
|
log "ERROR Invalid URL given for MODPACK: $downloadUrl resolved from $MODPACK"
|
||||||
log " Must be HTTP or HTTPS and a ZIP file"
|
log " Must be HTTP or HTTPS and a ZIP file"
|
||||||
@@ -58,39 +65,31 @@ 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
|
||||||
|
if [ "$TYPE" = "SPIGOT" ]; then
|
||||||
|
out_dir=/data/plugins
|
||||||
|
else
|
||||||
|
out_dir=/data/mods
|
||||||
|
fi
|
||||||
|
mkdir -p "$out_dir"
|
||||||
|
|
||||||
for i in ${MODS//,/ }
|
for i in ${MODS//,/ }
|
||||||
do
|
do
|
||||||
if isURL $i; then
|
if isURL $i; then
|
||||||
if [[ $i == *.jar ]]; then
|
log "Downloading mod/plugin $i ..."
|
||||||
EFFECTIVE_MOD_URL=$i
|
effective_url=$(resolveEffectiveUrl "$i")
|
||||||
else
|
if isValidFileURL jar "${effective_url}"; then
|
||||||
EFFECTIVE_MOD_URL=$(curl -Ls -o /dev/null -w %{url_effective} $i)
|
out_file=$(getFilenameFromUrl "${effective_url}")
|
||||||
if ! [[ $EFFECTIVE_MOD_URL == *.jar ]]; then
|
if ! curl -fsSL -o "${out_dir}/$out_file" "${effective_url}"; then
|
||||||
log "ERROR Invalid URL given in MODS: $EFFECTIVE_MOD_URL resolved from $i"
|
log "ERROR: failed to download from $i into $out_dir"
|
||||||
log " Must be HTTP or HTTPS and a JAR file"
|
exit 2
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
fi
|
else
|
||||||
|
log "ERROR: $effective_url resolved from $i is not a valid jar URL"
|
||||||
log "Downloading mod/plugin via HTTP"
|
|
||||||
log " from $EFFECTIVE_MOD_URL ..."
|
|
||||||
if ! curl -sSL -o /tmp/${EFFECTIVE_MOD_URL##*/} $EFFECTIVE_MOD_URL; then
|
|
||||||
log "ERROR: failed to download from $EFFECTIVE_MOD_URL to /tmp/${EFFECTIVE_MOD_URL##*/}"
|
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TYPE" = "SPIGOT" ]; then
|
|
||||||
mkdir -p /data/plugins
|
|
||||||
mv /tmp/${EFFECTIVE_MOD_URL##*/} /data/plugins/${EFFECTIVE_MOD_URL##*/}
|
|
||||||
else
|
|
||||||
mkdir -p /data/mods
|
|
||||||
mv /tmp/${EFFECTIVE_MOD_URL##*/} /data/mods/${EFFECTIVE_MOD_URL##*/}
|
|
||||||
fi
|
|
||||||
rm -f /tmp/${EFFECTIVE_MOD_URL##*/}
|
|
||||||
|
|
||||||
else
|
else
|
||||||
log "ERROR Invalid URL given in MODS: $i"
|
log "ERROR Invalid URL given in MODS: $i"
|
||||||
exit 1
|
exit 2
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@@ -100,7 +99,7 @@ if [[ "$MANIFEST" ]]; then
|
|||||||
EFFECTIVE_MANIFEST_FILE=$MANIFEST
|
EFFECTIVE_MANIFEST_FILE=$MANIFEST
|
||||||
elif isURL "$MANIFEST"; then
|
elif isURL "$MANIFEST"; then
|
||||||
EFFECTIVE_MANIFEST_FILE=/tmp/manifest.json
|
EFFECTIVE_MANIFEST_FILE=/tmp/manifest.json
|
||||||
EFFECTIVE_MANIFEST_URL=$(curl -Ls -o /dev/null -w %{url_effective} $MANIFEST)
|
EFFECTIVE_MANIFEST_URL=$(curl -Ls -o /dev/null -w %{effective_url} $MANIFEST)
|
||||||
curl -Ls -o $EFFECTIVE_MANIFEST_FILE "$EFFECTIVE_MANIFEST_URL"
|
curl -Ls -o $EFFECTIVE_MANIFEST_FILE "$EFFECTIVE_MANIFEST_URL"
|
||||||
else
|
else
|
||||||
log "MANIFEST='$MANIFEST' is not a valid manifest url or location"
|
log "MANIFEST='$MANIFEST' is not a valid manifest url or location"
|
||||||
@@ -121,7 +120,7 @@ case "X$EFFECTIVE_MANIFEST_FILE" in
|
|||||||
do
|
do
|
||||||
if [ ! -f $MOD_DIR/${p}_${f}.jar ]
|
if [ ! -f $MOD_DIR/${p}_${f}.jar ]
|
||||||
then
|
then
|
||||||
redirect_url="$(curl -Ls -o /dev/null -w %{url_effective} ${CURSE_URL_BASE}/${p})"
|
redirect_url="$(curl -Ls -o /dev/null -w %{effective_url} ${CURSE_URL_BASE}/${p})"
|
||||||
url="$redirect_url/download/${f}/file"
|
url="$redirect_url/download/${f}/file"
|
||||||
log Downloading curseforge mod $url
|
log Downloading curseforge mod $url
|
||||||
# Manifest usually doesn't have mod names. Using id should be fine, tho
|
# Manifest usually doesn't have mod names. Using id should be fine, tho
|
||||||
@@ -140,10 +139,9 @@ fi
|
|||||||
|
|
||||||
if [[ "${GENERIC_PACK}" ]]; then
|
if [[ "${GENERIC_PACK}" ]]; then
|
||||||
if isURL "${GENERIC_PACK}"; then
|
if isURL "${GENERIC_PACK}"; then
|
||||||
generic_pack_url=${GENERIC_PACK}
|
log "Downloading generic pack ..."
|
||||||
GENERIC_PACK=/tmp/$(basename ${generic_pack_url})
|
curl -fsSL -o /tmp/generic_pack.zip "${GENERIC_PACK}"
|
||||||
log "Downloading generic pack from ${generic_pack_url} ..."
|
GENERIC_PACK=/tmp/generic_pack.zip
|
||||||
curl -fsSL -o ${GENERIC_PACK} ${generic_pack_url}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sum_file=/data/.generic_pack.sum
|
sum_file=/data/.generic_pack.sum
|
||||||
|
|||||||
@@ -25,7 +25,12 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
|
|||||||
mkdir -p /tmp/world-data
|
mkdir -p /tmp/world-data
|
||||||
(cd /tmp/world-data && unzip -o -q "$zipSrc")
|
(cd /tmp/world-data && unzip -o -q "$zipSrc")
|
||||||
|
|
||||||
baseDirs=$(find /tmp/world-data -name "level.dat" -exec dirname "{}" \;)
|
if [ "$TYPE" = "SPIGOT" ]; then
|
||||||
|
baseDirs=$(find /tmp/world-data -name "level.dat" -not -path "*_nether*" -not -path "*_the_end*" -exec dirname "{}" \;)
|
||||||
|
else
|
||||||
|
baseDirs=$(find /tmp/world-data -name "level.dat" -exec dirname "{}" \;)
|
||||||
|
fi
|
||||||
|
|
||||||
count=$(echo "$baseDirs" | wc -l)
|
count=$(echo "$baseDirs" | wc -l)
|
||||||
if [[ $count -gt 1 ]]; then
|
if [[ $count -gt 1 ]]; then
|
||||||
baseDir="$(echo "$baseDirs" | sed -n ${WORLD_INDEX:-1}p)"
|
baseDir="$(echo "$baseDirs" | sed -n ${WORLD_INDEX:-1}p)"
|
||||||
@@ -38,6 +43,11 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
rsync --remove-source-files --recursive --delete "$baseDir/" "$worldDest"
|
rsync --remove-source-files --recursive --delete "$baseDir/" "$worldDest"
|
||||||
|
if [ "$TYPE" = "SPIGOT" ]; then
|
||||||
|
log "Copying end and nether ..."
|
||||||
|
[ -d "${baseDir}_nether" ] && rsync --remove-source-files --recursive --delete "${baseDir}_nether/" "${worldDest}_nether"
|
||||||
|
[ -d "${baseDir}_the_end" ] && rsync --remove-source-files --recursive --delete "${baseDir}_the_end/" "${worldDest}_the_end"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
log "Cloning world directory from $WORLD ..."
|
log "Cloning world directory from $WORLD ..."
|
||||||
rsync --recursive --delete "${WORLD%/}"/ "$worldDest"
|
rsync --recursive --delete "${WORLD%/}"/ "$worldDest"
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
|
: ${COPY_CONFIG_DEST:="/data/config"}
|
||||||
|
|
||||||
if [ -n "$OPS" ]; then
|
if [ -n "$OPS" ]; then
|
||||||
log "Setting/adding ops"
|
log "Setting/adding ops"
|
||||||
rm -rf /data/ops.txt.converted
|
rm -rf /data/ops.txt.converted
|
||||||
@@ -54,20 +56,14 @@ 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
|
||||||
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
|
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /mods /data
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -d /data/config ] || mkdir /data/config
|
if [ -d /config ]; then
|
||||||
for c in /config/*
|
log "Copying any configs from /config to $COPY_CONFIG_DEST"
|
||||||
do
|
mkdir -p $COPY_CONFIG_DEST
|
||||||
if [ -f "$c" ]; then
|
rsync -a --out-format="update:%f:Last Modified %M" "${rsyncArgs[@]}" --prune-empty-dirs --update /config/ $COPY_CONFIG_DEST
|
||||||
log Copying configuration $(basename "$c")
|
fi
|
||||||
cp -rf "$c" /data/config
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
EXTRA_ARGS=""
|
EXTRA_ARGS=""
|
||||||
# Optional disable console
|
# Optional disable console
|
||||||
|
|||||||
110
start-utils
110
start-utils
@@ -1,8 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }
|
function join_by() {
|
||||||
|
local d=$1
|
||||||
|
shift
|
||||||
|
echo -n "$1"
|
||||||
|
shift
|
||||||
|
printf "%s" "${@/#/$d}"
|
||||||
|
}
|
||||||
|
|
||||||
function isURL {
|
function isURL() {
|
||||||
local value=$1
|
local value=$1
|
||||||
|
|
||||||
if [[ ${value:0:8} == "https://" || ${value:0:7} == "http://" ]]; then
|
if [[ ${value:0:8} == "https://" || ${value:0:7} == "http://" ]]; then
|
||||||
@@ -12,90 +18,114 @@ function isURL {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function isTrue {
|
function isValidFileURL() {
|
||||||
|
suffix=${1:?Missing required suffix arg}
|
||||||
|
url=${2:?Missing required url arg}
|
||||||
|
|
||||||
|
[[ "$url" == http*://*.${suffix} || "$url" == http*://*.${suffix}\?* ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveEffectiveUrl() {
|
||||||
|
url="${1:?Missing required url argument}"
|
||||||
|
if ! curl -Ls -o /dev/null -w %{url_effective} "$url"; then
|
||||||
|
log "ERROR failed to resolve effective URL from $url"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFilenameFromUrl() {
|
||||||
|
url="${1:?Missing required url argument}"
|
||||||
|
strippedOfQuery="${url%\?*}"
|
||||||
|
basename "$strippedOfQuery"
|
||||||
|
}
|
||||||
|
|
||||||
|
function isTrue() {
|
||||||
local value=${1,,}
|
local value=${1,,}
|
||||||
|
|
||||||
result=
|
result=
|
||||||
|
|
||||||
case ${value} in
|
case ${value} in
|
||||||
true|on)
|
true | on)
|
||||||
result=0
|
result=0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
result=1
|
result=1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
return ${result}
|
return ${result}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isDebugging {
|
function isDebugging() {
|
||||||
if [[ -v DEBUG ]] && [[ ${DEBUG^^} = TRUE ]]; then
|
if [[ -v DEBUG ]] && [[ ${DEBUG^^} == TRUE ]]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function debug {
|
function debug() {
|
||||||
if isDebugging; then
|
if isDebugging; then
|
||||||
log "DEBUG: $*"
|
log "DEBUG: $*"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function logn {
|
function logn() {
|
||||||
echo -n "[init] $*"
|
echo -n "[init] $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
function log {
|
function log() {
|
||||||
echo "[init] $*"
|
echo "[init] $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
function logAutopause {
|
function logAutopause() {
|
||||||
echo "[Autopause loop] $*"
|
echo "[Autopause loop] $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
function logAutopauseAction {
|
function logAutopauseAction() {
|
||||||
echo "[$(date -Iseconds)] [Autopause] $*"
|
echo "[$(date -Iseconds)] [Autopause] $*"
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeMemSize {
|
function normalizeMemSize() {
|
||||||
local scale=1
|
local scale=1
|
||||||
case ${1,,} in
|
case ${1,,} in
|
||||||
*k)
|
*k)
|
||||||
scale=1024;;
|
scale=1024
|
||||||
*m)
|
;;
|
||||||
scale=1048576;;
|
*m)
|
||||||
*g)
|
scale=1048576
|
||||||
scale=1073741824;;
|
;;
|
||||||
|
*g)
|
||||||
|
scale=1073741824
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
val=${1:0: -1}
|
val=${1:0:-1}
|
||||||
echo $(( val * scale ))
|
echo $((val * scale))
|
||||||
}
|
}
|
||||||
|
|
||||||
function versionLessThan {
|
function versionLessThan() {
|
||||||
local activeParts
|
local activeParts
|
||||||
IFS=. read -ra activeParts <<< "${VANILLA_VERSION}"
|
IFS=. read -ra activeParts <<<"${VANILLA_VERSION}"
|
||||||
|
|
||||||
local givenParts
|
local givenParts
|
||||||
IFS=. read -ra givenParts <<< "$1"
|
IFS=. read -ra givenParts <<<"$1"
|
||||||
|
|
||||||
if (( ${#activeParts[@]} < 2 )); then
|
if ((${#activeParts[@]} < 2)); then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( ${#activeParts[@]} == 2 )); then
|
if ((${#activeParts[@]} == 2)); then
|
||||||
if (( activeParts[0] < givenParts[0] )) || \
|
if ((activeParts[0] < givenParts[0])) ||
|
||||||
(( activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1] )); then
|
((activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1])); then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if (( activeParts[0] < givenParts[0] )) || \
|
if ((activeParts[0] < givenParts[0])) ||
|
||||||
(( activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1] )) || \
|
((activeParts[0] == givenParts[0] && activeParts[1] < givenParts[1])) ||
|
||||||
(( activeParts[0] == givenParts[0] && activeParts[1] == givenParts[1] && activeParts[2] < givenParts[2] )); then
|
((activeParts[0] == givenParts[0] && activeParts[1] == givenParts[1] && activeParts[2] < givenParts[2])); then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
@@ -115,10 +145,10 @@ requireVar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function writeEula() {
|
function writeEula() {
|
||||||
if ! echo "# Generated via Docker on $(date)
|
if ! echo "# Generated via Docker on $(date)
|
||||||
eula=${EULA,,}
|
eula=${EULA,,}
|
||||||
" > /data/eula.txt; then
|
" >/data/eula.txt; then
|
||||||
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user