Compare commits

...

9 Commits

Author SHA1 Message Date
Geoff Bourne
79756d13fd mc: support CurseForge modpacks with LaunchServer.sh entry script 2018-09-30 14:39:37 -05:00
Geoff Bourne
44d2081b7b Merge pull request #253 from proudlytm/master
mc: set umask to 0002 and chmod g+w the /data folder
2018-09-27 08:25:29 -05:00
Maxim Ivanov
e8be7685e9 mc: set umask to 0002 and chmod g+w the /data folder
Do this to allow write access for groups that the minecraft user is in.

This commit also fixes an issue if a group is specified with $GID and it has
no write access in the mounted host volume.
2018-09-27 10:27:50 +03:00
Geoff Bourne
2d6316e6c3 mc: fix container stop handling 2018-09-20 19:57:01 -05:00
Geoff Bourne
009309966b Merge pull request #250 from proudlytm/master
README.md: Make it clearer how to override UID and GID.
2018-09-19 18:22:48 -05:00
Maxim Ivanov
d3e64ed56f README.md: Make it clearer how to override UID and GID. 2018-09-19 23:27:44 +03:00
Geoff Bourne
715d9be403 Merge pull request #249 from duaneg/master
mc: run FTB installer from correct location
2018-09-18 22:40:58 -05:00
Duane Griffin
ebe0a30c14 mc: run FTB installer from correct location
We have pushd'ed into the directory so do not prefix the shell script
with the directory name.
2018-09-19 11:27:34 +12:00
Geoff Bourne
c8eb0f5874 mc: enhance the WORLD option to allow for directory sources
#247
2018-09-11 20:38:54 -05:00
4 changed files with 53 additions and 17 deletions

View File

@@ -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
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
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
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
is passed to `docker run`.

View File

@@ -1,5 +1,8 @@
#!/bin/bash
umask 0002
chmod g+w /data
if [ $(id -u) = 0 ]; then
if [[ -v UID && $UID != $(id -u) ]]; then
usermod -u $UID minecraft
@@ -13,7 +16,7 @@ if [ $(id -u) = 0 ]; then
chown -R minecraft:minecraft /data
fi
su-exec minecraft:minecraft /start-configuration
exec su-exec minecraft:minecraft /start-configuration
else
exec /start-configuration
fi

View File

@@ -31,9 +31,9 @@ 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.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;;
esac
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 ""}'
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!"
exit 2
fi
export FTB_SERVER_START=./ServerStart.sh
export FTB_DIR=$(dirname $(find ${FTB_DIR} -name ServerStart.sh))
chmod a+x ${FTB_DIR}/${FTB_SERVER_START}
sed -i 's/-jar/-Dfml.queryResult=confirm -jar/' ${FTB_DIR}/${FTB_SERVER_START}
sed -i 's/.*read.*Restart now/#\0/' ${FTB_DIR}/${FTB_SERVER_START}
export FTB_SERVER_START=$(find ${FTB_BASE_DIR} -name ServerStart.sh -o -name LaunchServer.sh)
if [[ $(echo ${FTB_SERVER_START} | wc -w) != 1 ]]; then
echo "Please make sure you are using the server version of the FTB modpack!"
exit 2
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
if isTrue ${FTB_LEGACYJAVAFIXER} && [ ! -e ${legacyJavaFixerPath} ]; then
@@ -87,11 +92,11 @@ fi
if [ -e ${FTB_DIR}/FTBInstall.sh ]; then
pushd ${FTB_DIR}
sh ${FTB_DIR}/FTBInstall.sh
sh FTBInstall.sh
popd
elif [ -e ${FTB_DIR}/Install.sh ]; then
pushd ${FTB_DIR}
sh ${FTB_DIR}/Install.sh
sh Install.sh
popd
fi

View File

@@ -1,5 +1,7 @@
#!/bin/bash
worldDest=/data/$LEVEL
# If supplied with a URL for a world, download it and unpack
if [[ "$WORLD" ]]; then
case "X$WORLD" in
@@ -9,25 +11,34 @@ case "X$WORLD" in
echo "Unzipping world"
unzip -o -q /data/world.zip
rm -f /data/world.zip
if [ ! -d /data/world ]; then
if [ ! -d $worldDest ]; then
echo World directory not found
for i in /data/*/level.dat; do
if [ -f "$i" ]; then
d=`dirname "$i"`
echo Renaming world directory from $d
mv -f "$d" /data/world
mv -f "$d" $worldDest
fi
done
fi
if [ "$TYPE" = "SPIGOT" ]; then
# Reorganise if a Spigot server
echo "Moving End and Nether maps to Spigot location"
[ -d "/data/world/DIM1" ] && mv -f "/data/world/DIM1" "/data/world_the_end"
[ -d "/data/world/DIM-1" ] && mv -f "/data/world/DIM-1" "/data/world_nether"
[ -d "$worldDest/DIM1" ] && mv -f "$worldDest/DIM1" "/data/${LEVEL}_the_end"
[ -d "$worldDest/DIM-1" ] && mv -f "$worldDest/DIM-1" "/data/${LEVEL}_nether"
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
fi