mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-08-31 11:17:14 +00:00
Auto-merging via docker-versions-create
This commit is contained in:
@@ -65,6 +65,7 @@ By default, the container will download the latest version of the "vanilla" [Min
|
|||||||
* [Optional plugins, mods, and config attach points](#optional-plugins-mods-and-config-attach-points)
|
* [Optional plugins, mods, and config attach points](#optional-plugins-mods-and-config-attach-points)
|
||||||
* [Auto-downloading SpigotMC/Bukkit/PaperMC plugins](#auto-downloading-spigotmcbukkitpapermc-plugins)
|
* [Auto-downloading SpigotMC/Bukkit/PaperMC plugins](#auto-downloading-spigotmcbukkitpapermc-plugins)
|
||||||
* [Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers](#downloadable-modplugin-pack-for-forge-bukkit-and-spigot-servers)
|
* [Downloadable mod/plugin pack for Forge, Bukkit, and Spigot Servers](#downloadable-modplugin-pack-for-forge-bukkit-and-spigot-servers)
|
||||||
|
* [Generic pack file](#generic-pack-file)
|
||||||
* [Mod/Plugin URL Listing File](#modplugin-url-listing-file)
|
* [Mod/Plugin URL Listing File](#modplugin-url-listing-file)
|
||||||
* [Remove old mods/plugins](#remove-old-modsplugins)
|
* [Remove old mods/plugins](#remove-old-modsplugins)
|
||||||
* [Working with world data](#working-with-world-data)
|
* [Working with world data](#working-with-world-data)
|
||||||
@@ -131,7 +132,7 @@ By default, the container will download the latest version of the "vanilla" [Min
|
|||||||
* [Enabling Autopause](#enabling-autopause)
|
* [Enabling Autopause](#enabling-autopause)
|
||||||
* [Running on RaspberryPi](#running-on-raspberrypi)
|
* [Running on RaspberryPi](#running-on-raspberrypi)
|
||||||
|
|
||||||
<!-- Added by: runner, at: Wed Oct 20 02:36:47 UTC 2021 -->
|
<!-- Added by: runner, at: Wed Oct 20 20:36:22 UTC 2021 -->
|
||||||
|
|
||||||
<!--te-->
|
<!--te-->
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,14 @@ services:
|
|||||||
image: itzg/minecraft-server:${IMAGE_TAG:-java8}
|
image: itzg/minecraft-server:${IMAGE_TAG:-java8}
|
||||||
volumes:
|
volumes:
|
||||||
- ./modpacks:/modpacks:ro
|
- ./modpacks:/modpacks:ro
|
||||||
|
- data:/data
|
||||||
environment:
|
environment:
|
||||||
EULA: "true"
|
EULA: "true"
|
||||||
TYPE: CURSEFORGE
|
TYPE: CURSEFORGE
|
||||||
CF_SERVER_MOD: /modpacks/${MODPACK:-SkyFactory_4_Server_4.1.0.zip}
|
CF_SERVER_MOD: https://media.forgecdn.net/files/3012/800/SkyFactory-4_Server_4.2.2.zip
|
||||||
|
# CF_SERVER_MOD: /modpacks/${MODPACK:-SkyFactory_4_Server_4.1.0.zip}
|
||||||
ports:
|
ports:
|
||||||
- "25565:25565"
|
- "25565:25565"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
data: {}
|
||||||
+41
-44
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
# shellcheck source=start-utils
|
||||||
|
. "${SCRIPTS:-/}start-utils"
|
||||||
|
|
||||||
loadForgeVars() {
|
loadForgeVars() {
|
||||||
cfgFile=${1?}
|
cfgFile=${1?}
|
||||||
@@ -23,7 +24,7 @@ loadForgeVars() {
|
|||||||
|
|
||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
|
|
||||||
: ${FTB_BASE_DIR:=${CF_BASE_DIR:-/data/FeedTheBeast}}
|
: "${FTB_BASE_DIR:=${CF_BASE_DIR:-/data/FeedTheBeast}}"
|
||||||
export FTB_BASE_DIR
|
export FTB_BASE_DIR
|
||||||
|
|
||||||
legacyJavaFixerUrl=https://ftb.forgecdn.net/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
|
||||||
@@ -34,7 +35,7 @@ FTB_SERVER_MOD=${FTB_SERVER_MOD:-$CF_SERVER_MOD}
|
|||||||
log "Looking for Feed-The-Beast / CurseForge server modpack."
|
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
|
||||||
@@ -46,9 +47,9 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
|
|||||||
if [ "$(cat $installMarker)" != "${FTB_SERVER_MOD}" ]; then
|
if [ "$(cat $installMarker)" != "${FTB_SERVER_MOD}" ]; then
|
||||||
log "Upgrading modpack"
|
log "Upgrading modpack"
|
||||||
|
|
||||||
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,config}
|
rm -rf "$(dirname "${serverJar}")"/{mods,*.jar,libraries,resources,scripts,config}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
needsInstall=false
|
needsInstall=false
|
||||||
@@ -57,10 +58,10 @@ 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 ""}'
|
||||||
|
|
||||||
serverJar=$(find ${FTB_BASE_DIR} -type f \( -path "*/libraries/*" -o -path "*/mods/*" \) -prune -o -name "forge*.jar" -not -name "forge*installer.jar" -print)
|
serverJar=$(find "${FTB_BASE_DIR}" -type f \( -path "*/libraries/*" -o -path "*/mods/*" \) -prune -o -name "forge*.jar" -not -name "forge*installer.jar" -print)
|
||||||
if [[ -z "$serverJar" ]]; then
|
if [[ -z "$serverJar" ]]; then
|
||||||
|
|
||||||
if [ -f "${FTB_BASE_DIR}/settings.cfg" ]; then
|
if [ -f "${FTB_BASE_DIR}/settings.cfg" ]; then
|
||||||
@@ -86,22 +87,24 @@ if ! isTrue ${USE_MODPACK_START_SCRIPT:-true}; then
|
|||||||
|
|
||||||
log "Installing forge server"
|
log "Installing forge server"
|
||||||
dirOfInstaller=$(dirname "${forgeInstallerJar}")
|
dirOfInstaller=$(dirname "${forgeInstallerJar}")
|
||||||
(cd "${dirOfInstaller}"; java -jar $(basename "${forgeInstallerJar}") --installServer)
|
(cd "${dirOfInstaller}"; java -jar "$(basename "${forgeInstallerJar}")" --installServer)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${FTB_SERVER_MOD}" > $installMarker
|
echo "${FTB_SERVER_MOD}" > $installMarker
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export SERVER=$(find "${FTB_BASE_DIR}" -maxdepth 2 -type f \( -path "/libraries/*" -o -path "/mods/*" \) -prune -o -name "forge*.jar" -not -name "forge*installer.jar" -print)
|
SERVER=$(find "${FTB_BASE_DIR}" -maxdepth 2 -type f \( -path "/libraries/*" -o -path "/mods/*" \) -prune -o -name "forge*.jar" -not -name "forge*installer.jar" -print)
|
||||||
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"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
export SERVER
|
||||||
|
|
||||||
export FTB_DIR=$(dirname "${SERVER}")
|
FTB_DIR=$(dirname "${SERVER}")
|
||||||
|
export FTB_DIR
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-setupWorld $@
|
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
entryScriptExpr="
|
entryScriptExpr="
|
||||||
@@ -116,8 +119,8 @@ entryScriptExpr="
|
|||||||
"
|
"
|
||||||
|
|
||||||
if [[ -d ${FTB_BASE_DIR} ]]; then
|
if [[ -d ${FTB_BASE_DIR} ]]; then
|
||||||
startScriptCount=$(find ${FTB_BASE_DIR} $entryScriptExpr |wc -l)
|
startScriptCount=$(find "${FTB_BASE_DIR}" $entryScriptExpr |wc -l)
|
||||||
if [[ $startScriptCount > 1 ]]; then
|
if (( startScriptCount > 1 )); then
|
||||||
log "Conflicting FTB/CurseForge packages have been installed. Please cleanup ${FTB_BASE_DIR}"
|
log "Conflicting FTB/CurseForge packages have been installed. Please cleanup ${FTB_BASE_DIR}"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
@@ -131,22 +134,11 @@ fi
|
|||||||
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
|
log "Downloading modpack from ${srv_modpack}..."
|
||||||
https://www.feed-the-beast.com/*/download|https://www.curseforge.com/minecraft/modpacks/*/download/*/file)
|
if ! srv_modpack=$(get -o /data --output-filename --skip-existing "${srv_modpack}"); then
|
||||||
;;
|
log "ERROR: failed to download modpack"
|
||||||
https://www.curseforge.com/minecraft/modpacks/*/download/*)
|
exit 1
|
||||||
srv_modpack=${srv_modpack}/file;;
|
fi
|
||||||
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
|
fi
|
||||||
if [[ "${srv_modpack:0:5}" == "data/" ]]; then
|
if [[ "${srv_modpack:0:5}" == "data/" ]]; then
|
||||||
# Prepend with "/"
|
# Prepend with "/"
|
||||||
@@ -167,8 +159,8 @@ if [[ $startScriptCount = 0 ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
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 ""}'
|
||||||
|
|
||||||
installScript=$(find "${FTB_BASE_DIR}" -maxdepth 2 -type f -name install.sh)
|
installScript=$(find "${FTB_BASE_DIR}" -maxdepth 2 -type f -name install.sh)
|
||||||
if [[ "$installScript" ]]; then
|
if [[ "$installScript" ]]; then
|
||||||
@@ -181,13 +173,14 @@ if [[ $startScriptCount = 0 ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(find ${FTB_BASE_DIR} $entryScriptExpr | wc -l) = 0 ]]; then
|
if [[ $(find "${FTB_BASE_DIR}" $entryScriptExpr | wc -l) = 0 ]]; then
|
||||||
|
|
||||||
# Allow up to 2 levels since some modpacks have a top-level directory named
|
# Allow up to 2 levels since some modpacks have a top-level directory named
|
||||||
# for the modpack
|
# for the modpack
|
||||||
forgeJar=$(find "${FTB_BASE_DIR}" -maxdepth 2 -type f \( -path "/libraries/*" -o -path "/mods/*" \) -prune -o -name "forge*.jar" -not -name "forge*installer.jar" -print)
|
forgeJar=$(find "${FTB_BASE_DIR}" -maxdepth 2 -type f \( -path "/libraries/*" -o -path "/mods/*" \) -prune -o -name "forge*.jar" -not -name "forge*installer.jar" -print)
|
||||||
if [[ "$forgeJar" ]]; then
|
if [[ "$forgeJar" ]]; then
|
||||||
export FTB_BASE_DIR=$(dirname "${forgeJar}")
|
FTB_BASE_DIR=$(dirname "${forgeJar}")
|
||||||
|
export FTB_BASE_DIR
|
||||||
log "No entry script found, so building one for ${forgeJar}"
|
log "No entry script found, so building one for ${forgeJar}"
|
||||||
cat > "${FTB_BASE_DIR}/ServerStart.sh" <<EOF
|
cat > "${FTB_BASE_DIR}/ServerStart.sh" <<EOF
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
@@ -205,25 +198,29 @@ scriptCount=$(find "${FTB_BASE_DIR}" $entryScriptExpr | wc -l)
|
|||||||
if [[ $scriptCount = 0 ]]; then
|
if [[ $scriptCount = 0 ]]; then
|
||||||
log "Please make sure you are using the server version of the FTB modpack!"
|
log "Please make sure you are using the server version of the FTB modpack!"
|
||||||
exit 2
|
exit 2
|
||||||
elif [[ $scriptCount > 1 ]]; then
|
elif (( scriptCount > 1 )); then
|
||||||
log "Ambigous startup scripts in FTB modpack!"
|
log "Ambiguous startup scripts in FTB modpack! Found:"
|
||||||
log "found:"
|
find "${FTB_BASE_DIR}" $entryScriptExpr
|
||||||
find ${FTB_BASE_DIR} $entryScriptExpr
|
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export FTB_SERVER_START=$(find "${FTB_BASE_DIR}" $entryScriptExpr)
|
FTB_SERVER_START=$(find "${FTB_BASE_DIR}" $entryScriptExpr)
|
||||||
|
export FTB_SERVER_START
|
||||||
|
|
||||||
export FTB_DIR=$(dirname "${FTB_SERVER_START}")
|
FTB_DIR=$(dirname "${FTB_SERVER_START}")
|
||||||
|
export FTB_DIR
|
||||||
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"
|
||||||
|
|
||||||
if isTrue ${FTB_LEGACYJAVAFIXER} && [ ! -e "${legacyJavaFixerPath}" ]; then
|
if isTrue "${FTB_LEGACYJAVAFIXER}" && [ ! -e "${legacyJavaFixerPath}" ]; then
|
||||||
log "Installing legacy java fixer to ${legacyJavaFixerPath}"
|
log "Installing legacy java fixer to ${legacyJavaFixerPath}"
|
||||||
curl -sSL -o "${legacyJavaFixerPath}" ${legacyJavaFixerUrl}
|
if ! get -o "${legacyJavaFixerPath}" ${legacyJavaFixerUrl}; then
|
||||||
|
log "ERROR failed to download legacy java fixer from ${legacyJavaFixerUrl}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "${FTB_DIR}/FTBInstall.sh" ]; then
|
if [ -e "${FTB_DIR}/FTBInstall.sh" ]; then
|
||||||
@@ -236,4 +233,4 @@ elif [ -e "${FTB_DIR}/Install.sh" ]; then
|
|||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-setupWorld $@
|
exec "${SCRIPTS:-/}start-setupWorld" "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user