Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions entrypoint-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ exit_handler_user() {
echo -e "Loading exit handler"
trap exit_handler_user SIGQUIT SIGINT SIGTERM

execute_hook_directory() {
for f in $1; do
if ! bash "$f"
then
echo "Failed running hook \"$f\""
exit 1
fi
done
}

# Setup game server
if [ ! -f "${GAMESERVER}" ]; then
echo -e ""
Expand All @@ -30,6 +40,14 @@ elif [ -d "/app/lgsm/modules" ]; then
chmod +x /app/lgsm/modules/*
fi

# Run pre-install scripts
if [ -d "/app/hooks/pre-install" ]; then
echo -e ""
echo -e "Executing pre-install hooks"
echo -e "================================="
execute_hook_directory "/app/hooks/pre-install/*.sh"
fi

# Install game server
if [ -z "$(ls -A -- "/data/serverfiles" 2> /dev/null)" ]; then
echo -e ""
Expand Down Expand Up @@ -57,6 +75,14 @@ if [ -z "${install}" ]; then
./"${GAMESERVER}" update
fi

# Run pre-install scripts
if [ -d "/app/hooks/post-install" ]; then
echo -e ""
echo -e "Executing post-install hooks"
echo -e "================================="
execute_hook_directory "/app/hooks/post-install/*.sh"
fi

echo -e ""
echo -e "Starting ${GAMESERVER}"
echo -e "================================="
Expand Down