fix to allow upgrade of innodb to new pagesize as required by 12982 on install [SME: 13083]

This commit is contained in:
trevorb
2025-07-21 10:08:31 +10:00
parent cd59e93ccb
commit 17c47013a1
3 changed files with 32 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
#!/bin/sh
event=$1
# check event is defined or return
[[ -z "$event" ]] && exit 0
# check we run as post-install event or return
[[ "$event" == "post-install" ]] || exit 0
# check mariadb is not running or return
/usr/bin/systemctl is-active mariadb -q && exit 0
# ONLY delete the mysql data dirictory if it is initial state
# we assume if only mysql, test, sys and performance_schema this is the case
validdirs="/var/lib/mysql/mysql/ /var/lib/mysql/performance_schema/ /var/lib/mysql/sys/ /var/lib/mysql/test/"
for dir in $(ls -d /var/lib/mysql/*/) ; do
[[ $(echo ${validdirs} | grep ${dir}) ]] || exit 0
done
# we should be safe to reset dir content
# we use find as glob will ignore dot starting filename
# rm -rf /var/lib/mysql/*
find /var/lib/mysql -mindepth 1 -maxdepth 1 -print0 | xargs -0 rm -rf
return 0