master/mariadb/entrypoint.sh

53 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
# ****************************************************************************************************
# * ______ _ _ *
# * | ____| /\ (_) | | *
# * | |__ _ _ _ __ ___ _ __ ___ __ _ _ __ / \ _ _ __ _ __ ___ _ __| |_ ___ *
# * | __|| | | | '__/ _ \| '_ \ / _ \/ _` | '_ \ / /\ \ | | '__| '_ \ / _ \| '__| __/ __| *
# * | |___| |_| | | | (_) | |_) | __/ (_| | | | | / ____ \| | | | |_) | (_) | | | |_\__ \ *
# * |______\__,_|_| \___/| .__/ \___|\__,_|_| |_| /_/ \_\_|_| | .__/ \___/|_| \__|___/ *
# * | | | | *
# * |_| |_| *
# * *
# ****************************************************************************************************
# This file is part of the European Airports Project, a free, collaborative platform of airport data
# extending beyond the official AIPs.
# Copyright (C) 2023
# Florian Meissner <florianmeissner@gmx.de>
# This program is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software Foundation, either
# version 3 of the License, or (at your option) any later version. This program is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details. You should have received a copy of the GNU General Public License along with this program.
# (license.md in the root folder of this project) If not, see <http://www.gnu.org/licenses/>.
# Entry script to start the Docker container. This script performs preparatory actions before
# invoking the entrypoint script from the base image.
# The upstream entrypoint script can be found here:
# https://github.com/MariaDB/mariadb-docker/blob/56ef6d9f842e1ddf50e4359625a6e5cef1748c38/10.11/docker-entrypoint.sh
# Set database password for CheckMk from secret
pw=`cat /run/secrets/checkmkPw`
sed -i "s/password=\"\"/password=\"$pw\"/g" /etc/check_mk/mysql.cfg
# Run custom DB init script. This will superceed the upstream one.
/dbInit.sh
# Invoke upstream entrypoint. This must be the last entry!
# The call might seem a bit awkward since the original entrypoint script uses functons and skips
# them when called. So the initial function call must be replicated here. Also the original script
# cannot simply be ommitted since it does a lot of importent work without the MariaDB server would
# not start. Also MariaDB insists be be run as PID1 which is the entrypoint script selected in the
# Dockerfile.
source /usr/local/bin/docker-entrypoint.sh
_main mariadbd "$@"