Commit 7cbb45d1 authored by Tuukka Pasanen's avatar Tuukka Pasanen Committed by Daniel Black

MDEV-30952: Reformat Debian post and pre scripts

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