diff --git a/debian/mariadb-common.postinst b/debian/mariadb-common.postinst index 12f65bd3d92..53d131a3929 100644 --- a/debian/mariadb-common.postinst +++ b/debian/mariadb-common.postinst @@ -35,7 +35,7 @@ case "$1" in then update-alternatives --install /etc/mysql/my.cnf my.cnf "/etc/mysql/mariadb.cnf" 500 || true fi - ;; + ;; esac #DEBHELPER# diff --git a/debian/mariadb-common.postrm b/debian/mariadb-common.postrm index d0bfa266b7d..2548733a1b9 100644 --- a/debian/mariadb-common.postrm +++ b/debian/mariadb-common.postrm @@ -10,7 +10,7 @@ case "$1" in then /usr/share/mysql-common/configure-symlinks remove mariadb "/etc/mysql/mariadb.cnf" fi - ;; + ;; esac #DEBHELPER# diff --git a/debian/mariadb-server-10.6.postinst b/debian/mariadb-server-10.6.postinst index a259a50ac55..1a83f38dd25 100644 --- a/debian/mariadb-server-10.6.postinst +++ b/debian/mariadb-server-10.6.postinst @@ -100,7 +100,7 @@ this all away. EOF fi fi - rmdir $mysql_upgradedir 2>/dev/null || true + rmdir $mysql_upgradedir 2>/dev/null || true done @@ -113,9 +113,9 @@ EOF # perform mariadb-upgrade, (MDEV-22678). To keep the impact minimal, we # skip innodb and set key-buffer-size to 0 as it isn't reused. if [ -f "$mysql_datadir"/auto.cnf ] && [ -f "$mysql_datadir"/mysql/user.MYD ] && - [ ! lsof -nt "$mysql_datadir"/mysql/user.MYD > /dev/null ] && [ ! -f "$mysql_datadir"/undo_001 ]; then - echo "UPDATE mysql.user SET plugin='unix_socket' WHERE plugin='auth_socket';" | - mariadbd --skip-innodb --key_buffer_size=0 --default-storage-engine=MyISAM --bootstrap 2> /dev/null + [ ! lsof -nt "$mysql_datadir"/mysql/user.MYD > /dev/null ] && [ ! -f "$mysql_datadir"/undo_001 ]; then + echo "UPDATE mysql.user SET plugin='unix_socket' WHERE plugin='auth_socket';" | + mariadbd --skip-innodb --key_buffer_size=0 --default-storage-engine=MyISAM --bootstrap 2> /dev/null fi # Ensure the existence and right permissions for the database and @@ -171,8 +171,8 @@ EOF # Debian: can safely run on upgrades with existing databases set +e bash /usr/bin/mariadb-install-db --rpm --cross-bootstrap --user=mysql \ - --disable-log-bin --skip-test-db 2>&1 | \ - $ERR_LOGGER + --disable-log-bin --skip-test-db 2>&1 | \ + $ERR_LOGGER set -e # On new installations root user can connect via unix_socket. @@ -188,21 +188,21 @@ EOF install -o 0 -g 0 -m 0755 -d $mysql_cfgdir fi if [ ! -e "$dc" ]; then - cat /dev/null > $dc - echo "# THIS FILE IS OBSOLETE. STOP USING IT IF POSSIBLE." >>$dc - echo "# This file exists only for backwards compatibility for" >>$dc - echo "# tools that run '--defaults-file=/etc/mysql/debian.cnf'" >>$dc - echo "# and have root level access to the local filesystem." >>$dc - echo "# With those permissions one can run 'mariadb' directly" >>$dc - echo "# anyway thanks to unix socket authentication and hence" >>$dc - echo "# this file is useless. See package README for more info." >>$dc - echo "[client]" >>$dc - echo "host = localhost" >>$dc - echo "user = root" >>$dc - echo "[mysql_upgrade]" >>$dc - echo "host = localhost" >>$dc - echo "user = root" >>$dc - echo "# THIS FILE WILL BE REMOVED IN A FUTURE DEBIAN RELEASE." >>$dc + cat /dev/null > $dc + echo "# THIS FILE IS OBSOLETE. STOP USING IT IF POSSIBLE." >>$dc + echo "# This file exists only for backwards compatibility for" >>$dc + echo "# tools that run '--defaults-file=/etc/mysql/debian.cnf'" >>$dc + echo "# and have root level access to the local filesystem." >>$dc + echo "# With those permissions one can run 'mariadb' directly" >>$dc + echo "# anyway thanks to unix socket authentication and hence" >>$dc + echo "# this file is useless. See package README for more info." >>$dc + echo "[client]" >>$dc + echo "host = localhost" >>$dc + echo "user = root" >>$dc + echo "[mysql_upgrade]" >>$dc + echo "host = localhost" >>$dc + echo "user = root" >>$dc + echo "# THIS FILE WILL BE REMOVED IN A FUTURE DEBIAN RELEASE." >>$dc fi # Keep it only root-readable, as it always was chown 0:0 $dc @@ -229,10 +229,10 @@ EOF # will think the service is masked echo "# empty placeholder" > /etc/systemd/system/mariadb.service.d/migrated-from-my.cnf-settings.conf - ;; + ;; abort-upgrade|abort-remove|abort-configure) - ;; + ;; triggered) if [ -d /run/systemd/system ]; then @@ -240,12 +240,12 @@ EOF else invoke-rc.d mariadb restart fi - ;; + ;; *) echo "postinst called with unknown argument '$1'" 1>&2 exit 1 - ;; + ;; esac db_stop # in case invoke fails @@ -263,11 +263,11 @@ fi # Modified dh_systemd_start snippet that's not added automatically if [ -d /run/systemd/system ]; then - systemctl --system daemon-reload >/dev/null || true - deb-systemd-invoke start mariadb.service >/dev/null || true -# Modified dh_installinit snippet to only run with sysvinit + systemctl --system daemon-reload >/dev/null || true + deb-systemd-invoke start mariadb.service >/dev/null || true + # Modified dh_installinit snippet to only run with sysvinit elif [ -x "/etc/init.d/mariadb" ]; then - if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then - invoke-rc.d mariadb start || exit $? - fi + if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then + invoke-rc.d mariadb start || exit $? + fi fi diff --git a/debian/mariadb-server-10.6.postrm b/debian/mariadb-server-10.6.postrm index 94ce91db31d..82fffef4eae 100644 --- a/debian/mariadb-server-10.6.postrm +++ b/debian/mariadb-server-10.6.postrm @@ -15,24 +15,24 @@ MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" # do it himself. No database directories should be removed while the server # is running! Another mariadbd in e.g. a different chroot is fine for us. stop_server() { - # Return immediately if there are no mysqld processes running - # as there is no point in trying to shutdown in that case. - if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null; then return; fi + # Return immediately if there are no mysqld processes running + # as there is no point in trying to shutdown in that case. + if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null; then return; fi - set +e - invoke-rc.d mariadb stop - invoke-rc.d mysql stop # Backwards compatibility - errno=$? - set -e + set +e + invoke-rc.d mariadb stop + invoke-rc.d mysql stop # Backwards compatibility + errno=$? + set -e - # systemctl could emit exit code 100=no init script (fresh install) - if [ "$errno" != 0 -a "$errno" != 100 ]; then - echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2 - echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2 - echo "Stop it yourself and try again!" 1>&2 - db_stop - exit 1 - fi + # systemctl could emit exit code 100=no init script (fresh install) + if [ "$errno" != 0 -a "$errno" != 100 ]; then + echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2 + echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2 + echo "Stop it yourself and try again!" 1>&2 + db_stop + exit 1 + fi } @@ -42,11 +42,11 @@ case "$1" in stop_server sleep 2 fi - ;; + ;; *) echo "postrm called with unknown argument '$1'" 1>&2 exit 1 - ;; + ;; esac # @@ -75,9 +75,9 @@ if [ "$1" = "purge" ] && [ -f "/var/lib/mysql/debian-$MAJOR_VER.flag" ]; then if [ -d /var/lib/mysql ] then find /var/lib/mysql -mindepth 1 \ - -not -path '*/lost+found/*' -not -name 'lost+found' \ - -not -path '*/lost@002bfound/*' -not -name 'lost@002bfound' \ - -delete + -not -path '*/lost+found/*' -not -name 'lost+found' \ + -not -path '*/lost@002bfound/*' -not -name 'lost@002bfound' \ + -delete # "|| true" still needed as rmdir still exits with non-zero if # /var/lib/mysql is a mount point @@ -93,5 +93,5 @@ fi # Modified dh_systemd_start snippet that's not added automatically if [ -d /run/systemd/system ]; then - systemctl --system daemon-reload >/dev/null || true + systemctl --system daemon-reload >/dev/null || true fi diff --git a/debian/mariadb-server-10.6.preinst b/debian/mariadb-server-10.6.preinst index c865173e29e..c203e6f0ade 100644 --- a/debian/mariadb-server-10.6.preinst +++ b/debian/mariadb-server-10.6.preinst @@ -14,7 +14,7 @@ MAJOR_VER="${DPKG_MAINTSCRIPT_PACKAGE#mariadb-server-}" # Just kill the invalid insserv.conf.d directory without fallback if [ -d "/etc/insserv.conf.d/mariadb/" ]; then - rm -rf "/etc/insserv.conf.d/mariadb/" + rm -rf "/etc/insserv.conf.d/mariadb/" fi if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi @@ -28,25 +28,25 @@ mysql_upgradedir=/var/lib/mysql-upgrade # do it himself. No database directories should be removed while the server # is running! Another mariadbd in e.g. a different chroot is fine for us. stop_server() { - # Return immediately if there are no mysqld processes running on a host - # (leave containerized processes with the same name in other namespaces) - # as there is no point in trying to shutdown in that case. - if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null; then return; fi + # Return immediately if there are no mysqld processes running on a host + # (leave containerized processes with the same name in other namespaces) + # as there is no point in trying to shutdown in that case. + if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null; then return; fi - set +e - invoke-rc.d mariadb stop - invoke-rc.d mysql stop # Backwards compatibility - errno=$? - set -e + set +e + invoke-rc.d mariadb stop + invoke-rc.d mysql stop # Backwards compatibility + errno=$? + set -e - # systemctl could emit exit code 100=no init script (fresh install) - if [ "$errno" != 0 -a "$errno" != 100 ]; then - echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2 - echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2 - echo "Stop it yourself and try again!" 1>&2 - db_stop - exit 1 - fi + # systemctl could emit exit code 100=no init script (fresh install) + if [ "$errno" != 0 -a "$errno" != 100 ]; then + echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2 + echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2 + echo "Stop it yourself and try again!" 1>&2 + db_stop + exit 1 + fi } ################################ main() ########################## @@ -112,7 +112,7 @@ then fi if dpkg --compare-versions "$found_version" '>>' "$max_upgradeable_version" \ - && dpkg --compare-versions "$found_version" '<<' "10.0" + && dpkg --compare-versions "$found_version" '<<' "10.0" then downgrade_detected=true fi @@ -171,22 +171,22 @@ fi # creating mysql group if he isn't already there if ! getent group mysql >/dev/null; then - # Adding system group: mysql. - addgroup --system mysql >/dev/null + # Adding system group: mysql. + addgroup --system mysql >/dev/null fi # creating mysql user if he isn't already there if ! getent passwd mysql >/dev/null; then - # Adding system user: mysql. - adduser \ - --system \ - --disabled-login \ - --ingroup mysql \ - --no-create-home \ - --home /nonexistent \ - --gecos "MySQL Server" \ - --shell /bin/false \ - mysql >/dev/null + # Adding system user: mysql. + adduser \ + --system \ + --disabled-login \ + --ingroup mysql \ + --no-create-home \ + --home /nonexistent \ + --gecos "MySQL Server" \ + --shell /bin/false \ + mysql >/dev/null fi # end of NIS tolerance zone @@ -205,7 +205,7 @@ done # creating mysql home directory if [ ! -d $mysql_datadir ] && [ ! -L $mysql_datadir ]; then - # Use mkdir option 'Z' to create with correct SELinux context. + # Use mkdir option 'Z' to create with correct SELinux context. mkdir -Z $mysql_datadir fi diff --git a/debian/mariadb-server-10.6.prerm b/debian/mariadb-server-10.6.prerm index 8fd172da9d2..0325a80c9b6 100644 --- a/debian/mariadb-server-10.6.prerm +++ b/debian/mariadb-server-10.6.prerm @@ -5,8 +5,8 @@ set -e # Modified dh_systemd_start snippet that's not added automatically if [ -d /run/systemd/system ]; then - deb-systemd-invoke stop mariadb.service >/dev/null -# Modified dh_installinit snippet to only run with sysvinit + deb-systemd-invoke stop mariadb.service >/dev/null + # Modified dh_installinit snippet to only run with sysvinit elif [ -x "/etc/init.d/mariadb" ]; then - invoke-rc.d mariadb stop || exit $? + invoke-rc.d mariadb stop || exit $? fi