Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
Extend mariadb-server to purge gracefully if datadir is a mountpoint …
Browse files Browse the repository at this point in the history
…(Closes: #829491)

This will also
* not use the existence of lost+found as indicator for /var/lib/mysql
  being a mount point.
* to also keep erroneously renamed lost+found directories as they
  might continue to exist after a switch from MySQL to MariaDB.
  • Loading branch information
xtaran authored and ottok committed Jul 4, 2016
1 parent da407b9 commit fddb4c3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion debian/mariadb-server-10.0.postrm
Expand Up @@ -56,7 +56,17 @@ if [ "$1" = "purge" -a ! \( -x /usr/sbin/mysqld -o -L /usr/sbin/mysqld \) ]; the
# never remove the debian.cnf when the databases are still existing
# else we ran into big trouble on the next install!
rm -f /etc/mysql/debian.cnf
rm -rf /var/lib/mysql
# Remove all contents from /var/lib/mysql except if it's a
# directory with file system data. See #829491 for details and
# #608938 for potential mysql-server leftovers which erroneously
# had been renamed.
find /var/lib/mysql -mindepth 1 \
-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
rmdir --ignore-fail-on-non-empty /var/lib/mysql || true
rm -rf /var/run/mysqld # this directory is created by the init script, don't leave behind
userdel mysql || true
fi
Expand Down

0 comments on commit fddb4c3

Please sign in to comment.