Debian Codegraph @

debian/additions/debian-start

raw
1 #!/bin/bash
2 #
3 # This script is executed by both SysV init /etc/init.d/mariadb and
4 # systemd mariadb.service on every (re)start.
5 #
6 # Changes to this file will be preserved when updating the Debian package.
7 #
8
9 # shellcheck source=debian/additions/debian-start.inc.sh
10 source /usr/share/mariadb/debian-start.inc.sh
11
12 # Read default/mysql first and then default/mariadb just like the init.d file does
13 if [ -f /etc/default/mysql ]
14 then
15 # shellcheck source=/dev/null
16 . /etc/default/mysql
17 fi
18
19 if [ -f /etc/default/mariadb ]
20 then
21 # shellcheck source=/dev/null
22 . /etc/default/mariadb
23 fi
24
25 # Legacy credentials file from old installations. It is not present on new
26 # installs and should not be unconditionally referenced.
27 DEBIAN_CNF_OPT=""
28 if [ -r /etc/mysql/debian.cnf ]; then
29 DEBIAN_CNF_OPT="--defaults-extra-file=/etc/mysql/debian.cnf"
30 fi
31
32 # Variable used in check_root_accounts()
33 # shellcheck disable=SC2034
34 MARIADB="/usr/bin/mariadb $DEBIAN_CNF_OPT"
35
36 # Don't run full mariadb-upgrade on every server restart, use --version-check to do it only once
37 # Variable used in upgrade_system_tables_if_necessary()
38 # shellcheck disable=SC2034
39 MYUPGRADE="/usr/bin/mariadb-upgrade $DEBIAN_CNF_OPT --version-check --silent"
40
41 # The following commands should be run when the server is up but in background
42 # where they do not block the server start and in one shell instance so that
43 # they run sequentially. They are supposed not to echo anything to stdout.
44 # (There may be no output to stdout inside the background process!)
45
46 # Need to ignore SIGHUP, as otherwise a SIGHUP can sometimes abort the upgrade
47 # process in the middle.
48 trap "" SIGHUP
49 (
50 upgrade_system_tables_if_necessary;
51 check_root_accounts;
52 ) >&2 &
53
54 exit 0