| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# Copyright (c) 2015, 2026, Oracle and/or its affiliates. |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License, version 2.0, |
| 7 |
# as published by the Free Software Foundation. |
| 8 |
# |
| 9 |
# This program is designed to work with certain software (including |
| 10 |
# but not limited to OpenSSL) that is licensed under separate terms, |
| 11 |
# as designated in a particular file or component or in included license |
| 12 |
# documentation. The authors of MySQL hereby grant you an additional |
| 13 |
# permission to link the program and your derivative works with the |
| 14 |
# separately licensed software that they have either included with |
| 15 |
# the program or referenced in the documentation. |
| 16 |
# |
| 17 |
# This program is distributed in the hope that it will be useful, |
| 18 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
# GNU General Public License, version 2.0, for more details. |
| 21 |
# |
| 22 |
# You should have received a copy of the GNU General Public License |
| 23 |
# along with this program; if not, write to the Free Software |
| 24 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 25 |
|
| 26 |
# Scripts to run by MySQL systemd service |
| 27 |
# |
| 28 |
# Needed argument: pre |
| 29 |
# |
| 30 |
# pre mode : try to perform sanity check for configuration, log, data |
| 31 |
|
| 32 |
# Include helper functions |
| 33 |
. /usr/share/mysql-@MYSQL_BASE_VERSION@/mysql-helpers |
| 34 |
|
| 35 |
sanity () { |
| 36 |
# Make sure database and required directories exist |
| 37 |
verify_ready $1 |
| 38 |
verify_database $1 |
| 39 |
|
| 40 |
@DEB_INIT_SERVER_APPARMOR@ |
| 41 |
|
| 42 |
if [ ! -r /etc/mysql/my.cnf ]; then |
| 43 |
echo "MySQL configuration not found at /etc/mysql/my.cnf. Please install one." |
| 44 |
exit 1 |
| 45 |
fi |
| 46 |
} |
| 47 |
|
| 48 |
case $1 in |
| 49 |
"pre") sanity $2 ;; |
| 50 |
esac |