working on world name selection

This commit is contained in:
leca 2024-09-29 18:29:50 +03:00
parent 22668fa16e
commit 253a7868d1
4 changed files with 11 additions and 8 deletions

View File

@ -34,6 +34,7 @@ RUN rm -rf /home/minetest/minetest-source/
USER minetest
WORKDIR /usr/local/share/minetest
RUN mkdir -p worlds
EXPOSE 30000/udp
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -3,16 +3,16 @@ services:
environment:
- SERVER_GAME
- SERVER_ADMIN
- WORLD_NAME
build:
context: .
restart: always
network_mode: host
volumes:
# - type: bind
# source: ./data/.env
# target: /usr/local/share/minetest.env
- ${PWD}/sample.env:/usr/local/share/minetest/.env
- ${PWD}/data/games:/usr/local/share/minetest/games
- ${PWD}/data/worlds:/usr/local/share/minetest/worlds
ports:
- "30000:30000/udp"
- "127.0.0.1:30000:30000/tcp"

View File

@ -9,4 +9,6 @@ echo $SERVER_ADMIN
#Set up admin name
echo "name = ${SERVER_ADMIN}" > /usr/local/share/minetest/minetest.conf
/usr/local/bin/minetestserver --gameid $gameid --config /usr/local/share/minetest/minetest.conf
/usr/local/bin/minetestserver --gameid $gameid \
--config /usr/local/share/minetest/minetest.conf \
--world /usr/local/share/minetest/worlds/${WORLD_NAME}

View File

@ -7,7 +7,7 @@ download_and_install_game() {
download_url=$(curl -X GET --silent "$API_URL/packages/${1}/" | jq ".url" | tr -d '"')
cd games || exit
wget -O game.zip "${download_url}"
unzip -foqq game.zip
unzip -foq game.zip
rm game.zip
cd ../ # data
}
@ -18,8 +18,8 @@ cd data || exit
calculated_dependencies=()
#Checking for input
if [[ $SERVER_MODS == "" || $SERVER_GAME == "" ]]; then
echo "Please, fill server.env file before launching this script!"
if [[ $SERVER_MODS == "" || $SERVER_GAME == "" || $WORLD_NAME == "" ]]; then
echo "Please, fill .env file before launching this script!"
exit 1
fi
@ -57,7 +57,7 @@ download_and_install_mod () {
mod_file="${mods_path}/mod.zip"
echo "Writing to ${mod_file} content from url ${mod_url}"
wget -O "${mod_file}" "${mod_url}"
unzip -foqq "${mod_file}" -d "${mods_path}"
unzip -foq "${mod_file}" -d "${mods_path}"
rm "${mod_file}"
}