mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-03-31 02:42:45 +00:00
Compare commits
9 Commits
mc-2018-1
...
test-20180
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79756d13fd | ||
|
|
44d2081b7b | ||
|
|
e8be7685e9 | ||
|
|
2d6316e6c3 | ||
|
|
009309966b | ||
|
|
d3e64ed56f | ||
|
|
715d9be403 | ||
|
|
ebe0a30c14 | ||
|
|
c8eb0f5874 |
@@ -674,6 +674,19 @@ will be deleted when the container is deleted.
|
|||||||
you should use an IP address or a globally resolveable FQDN, or else the
|
you should use an IP address or a globally resolveable FQDN, or else the
|
||||||
name of a linked container.
|
name of a linked container.
|
||||||
|
|
||||||
|
### Cloning world from a container path
|
||||||
|
|
||||||
|
The `WORLD` option can also be used to reference a directory that will be used
|
||||||
|
as a source to clone the world directory.
|
||||||
|
|
||||||
|
For example, the following would initially clone the world's content
|
||||||
|
from `/worlds/basic`. Also notice in the example that you can use a
|
||||||
|
read-only volume attachment to ensure the clone source remains pristine.
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run ... -v $HOME/worlds:/worlds:ro -e WORLD=/worlds/basic
|
||||||
|
```
|
||||||
|
|
||||||
### 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"
|
||||||
@@ -717,7 +730,11 @@ Allows users to use flight on your server while in Survival mode, if they have a
|
|||||||
### Running as alternate user/group ID
|
### Running as alternate user/group ID
|
||||||
|
|
||||||
By default, the container will switch to user ID 1000 and group ID 1000;
|
By default, the container will switch to user ID 1000 and group ID 1000;
|
||||||
however, you can override those values by setting `UID` and `GID`, respectively.
|
however, you can override those values by setting `UID` and/or `GID` as environmental entries, during the `docker run` command.
|
||||||
|
|
||||||
|
-e UID=1234
|
||||||
|
-e GID=1234
|
||||||
|
|
||||||
The container will also skip user switching if the `--user`/`-u` argument
|
The container will also skip user switching if the `--user`/`-u` argument
|
||||||
is passed to `docker run`.
|
is passed to `docker run`.
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
umask 0002
|
||||||
|
chmod g+w /data
|
||||||
|
|
||||||
if [ $(id -u) = 0 ]; then
|
if [ $(id -u) = 0 ]; then
|
||||||
if [[ -v UID && $UID != $(id -u) ]]; then
|
if [[ -v UID && $UID != $(id -u) ]]; then
|
||||||
usermod -u $UID minecraft
|
usermod -u $UID minecraft
|
||||||
@@ -13,7 +16,7 @@ if [ $(id -u) = 0 ]; then
|
|||||||
chown -R minecraft:minecraft /data
|
chown -R minecraft:minecraft /data
|
||||||
fi
|
fi
|
||||||
|
|
||||||
su-exec minecraft:minecraft /start-configuration
|
exec su-exec minecraft:minecraft /start-configuration
|
||||||
else
|
else
|
||||||
exec /start-configuration
|
exec /start-configuration
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ 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.feed-the-beast.com/*/download|https://minecraft.curseforge.com/*/download)
|
||||||
;;
|
;;
|
||||||
https://www.feed-the-beast.com/*)
|
https://www.feed-the-beast.com/*|https://minecraft.curseforge.com/*)
|
||||||
srv_modpack=${srv_modpack}/download;;
|
srv_modpack=${srv_modpack}/download;;
|
||||||
esac
|
esac
|
||||||
file=$(basename $(dirname $srv_modpack))
|
file=$(basename $(dirname $srv_modpack))
|
||||||
@@ -68,16 +68,21 @@ if [[ $startScriptCount = 0 ]]; then
|
|||||||
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} -name ServerStart.sh |wc -l) = 0 ]]; then
|
if [[ $(find ${FTB_BASE_DIR} -name ServerStart.sh -o -name LaunchServer.sh |wc -l) = 0 ]]; then
|
||||||
echo "Please make sure you are using the server version of the FTB modpack!"
|
echo "Please make sure you are using the server version of the FTB modpack!"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export FTB_SERVER_START=./ServerStart.sh
|
export FTB_SERVER_START=$(find ${FTB_BASE_DIR} -name ServerStart.sh -o -name LaunchServer.sh)
|
||||||
export FTB_DIR=$(dirname $(find ${FTB_DIR} -name ServerStart.sh))
|
if [[ $(echo ${FTB_SERVER_START} | wc -w) != 1 ]]; then
|
||||||
chmod a+x ${FTB_DIR}/${FTB_SERVER_START}
|
echo "Please make sure you are using the server version of the FTB modpack!"
|
||||||
sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' ${FTB_DIR}/${FTB_SERVER_START}
|
exit 2
|
||||||
sed -i 's/.*read.*Restart now/#\0/' ${FTB_DIR}/${FTB_SERVER_START}
|
fi
|
||||||
|
|
||||||
|
export FTB_DIR=$(dirname ${FTB_SERVER_START})
|
||||||
|
chmod a+x ${FTB_SERVER_START}
|
||||||
|
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
|
legacyJavaFixerPath=${FTB_DIR}/mods/legacyjavafixer.jar
|
||||||
|
|
||||||
if isTrue ${FTB_LEGACYJAVAFIXER} && [ ! -e ${legacyJavaFixerPath} ]; then
|
if isTrue ${FTB_LEGACYJAVAFIXER} && [ ! -e ${legacyJavaFixerPath} ]; then
|
||||||
@@ -87,11 +92,11 @@ fi
|
|||||||
|
|
||||||
if [ -e ${FTB_DIR}/FTBInstall.sh ]; then
|
if [ -e ${FTB_DIR}/FTBInstall.sh ]; then
|
||||||
pushd ${FTB_DIR}
|
pushd ${FTB_DIR}
|
||||||
sh ${FTB_DIR}/FTBInstall.sh
|
sh FTBInstall.sh
|
||||||
popd
|
popd
|
||||||
elif [ -e ${FTB_DIR}/Install.sh ]; then
|
elif [ -e ${FTB_DIR}/Install.sh ]; then
|
||||||
pushd ${FTB_DIR}
|
pushd ${FTB_DIR}
|
||||||
sh ${FTB_DIR}/Install.sh
|
sh Install.sh
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
worldDest=/data/$LEVEL
|
||||||
|
|
||||||
# If supplied with a URL for a world, download it and unpack
|
# If supplied with a URL for a world, download it and unpack
|
||||||
if [[ "$WORLD" ]]; then
|
if [[ "$WORLD" ]]; then
|
||||||
case "X$WORLD" in
|
case "X$WORLD" in
|
||||||
@@ -9,25 +11,34 @@ case "X$WORLD" in
|
|||||||
echo "Unzipping world"
|
echo "Unzipping world"
|
||||||
unzip -o -q /data/world.zip
|
unzip -o -q /data/world.zip
|
||||||
rm -f /data/world.zip
|
rm -f /data/world.zip
|
||||||
if [ ! -d /data/world ]; then
|
if [ ! -d $worldDest ]; then
|
||||||
echo World directory not found
|
echo World directory not found
|
||||||
for i in /data/*/level.dat; do
|
for i in /data/*/level.dat; do
|
||||||
if [ -f "$i" ]; then
|
if [ -f "$i" ]; then
|
||||||
d=`dirname "$i"`
|
d=`dirname "$i"`
|
||||||
echo Renaming world directory from $d
|
echo Renaming world directory from $d
|
||||||
mv -f "$d" /data/world
|
mv -f "$d" $worldDest
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [ "$TYPE" = "SPIGOT" ]; then
|
if [ "$TYPE" = "SPIGOT" ]; then
|
||||||
# Reorganise if a Spigot server
|
# Reorganise if a Spigot server
|
||||||
echo "Moving End and Nether maps to Spigot location"
|
echo "Moving End and Nether maps to Spigot location"
|
||||||
[ -d "/data/world/DIM1" ] && mv -f "/data/world/DIM1" "/data/world_the_end"
|
[ -d "$worldDest/DIM1" ] && mv -f "$worldDest/DIM1" "/data/${LEVEL}_the_end"
|
||||||
[ -d "/data/world/DIM-1" ] && mv -f "/data/world/DIM-1" "/data/world_nether"
|
[ -d "$worldDest/DIM-1" ] && mv -f "$worldDest/DIM-1" "/data/${LEVEL}_nether"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Invalid URL given for world: Must be HTTP or HTTPS and a ZIP file"
|
if [[ -d $WORLD ]]; then
|
||||||
|
if [[ ! -d $worldDest ]]; then
|
||||||
|
echo "Cloning world directory from $WORLD ..."
|
||||||
|
cp -r $WORLD $worldDest
|
||||||
|
else
|
||||||
|
echo "Skipping clone from $WORLD since $worldDest exists"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Invalid URL given for world: Must be HTTP or HTTPS and a ZIP file"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user