pso-newserv-docker/docker-image/entrypoint.sh

34 lines
1.2 KiB
Bash
Raw Permalink Normal View History

2023-12-02 18:53:16 -05:00
#!/bin/bash
if [ "$(id -u)" -ne "$(stat -c '%u' $HOME/system)" ]; then
echo "The 'system' volume is not writable by newserv."
echo "Change the 'system' local volume mount user:group to $(id -u):$(id -g)."
exit 1
fi
if [ -d "$HOME/system" ] && test -n "$(find $HOME/system -maxdepth 0 -empty)" ; then
echo "Newserv system directory not initialized, will initialize one for you right now."
cp -r $HOME/new-system-template/* $HOME/system/
mkdir -p $HOME/system/players # otherwise, bb clients crash on new char creation!
echo
echo "********************************************************************************"
echo "This docker image will now abort for you to initially configure newserv!"
echo
echo "To proceed you must do the following:"
echo "- Copy 'system/config.example.json' to 'system/config.json'"
echo "- Edit 'system/config.json' to your liking"
echo "- Re-run this container"
echo "********************************************************************************"
echo
exit 1
fi
if [ ! -f "$HOME/system/config.json" ]; then
echo "No 'system/config.json' found. Aborting."
echo "Did you forget to copy 'system/config.example.json' to 'system/config.json'?"
exit 1
fi
exec $HOME/newserv $@