Blame SOURCES/mysql-check-upgrade.sh

dbc8c5
#!/bin/sh
dbc8c5
dbc8c5
source "`dirname ${BASH_SOURCE[0]}`/mysql-scripts-common"
dbc8c5
dbc8c5
upgrade_info_file="$datadir/mysql_upgrade_info"
dbc8c5
version=0
dbc8c5
# get version as integer from mysql_upgrade_info file
dbc8c5
if [ -f "$upgrade_info_file" ] && [ -r "$upgrade_info_file" ] ; then
dbc8c5
    version_major=$(cat "$upgrade_info_file" | head -n 1 | sed -e 's/\([0-9]*\)\.\([0-9]*\)\..*$/\1/')
dbc8c5
    version_minor=$(cat "$upgrade_info_file" | head -n 1 | sed -e 's/\([0-9]*\)\.\([0-9]*\)\..*$/\2/')
dbc8c5
    if [[ $version_major =~ ^[0-9]+$ ]] && [[ $version_minor =~ ^[0-9]+$ ]] ; then
dbc8c5
        version=$((version_major*100+version_minor))
dbc8c5
    fi
dbc8c5
fi
dbc8c5
dbc8c5
# compute current version as integer
dbc8c5
thisversion=$((@MAJOR_VERSION@*100+@MINOR_VERSION@))
dbc8c5
dbc8c5
# provide warning in cases we should run mysql_upgrade
dbc8c5
if [ $version -ne $thisversion ] ; then
dbc8c5
dbc8c5
    # give extra warning if some version seems to be skipped
dbc8c5
    if [ $version -gt 0 ] && [ $version -lt 505 ] ; then
dbc8c5
        echo "The datadir located at $datadir seems to be older than of a version 5.5. Please, mind that as a general rule, to upgrade from one release series to another, go to the next series rather than skipping a series." >&2
dbc8c5
    fi
dbc8c5
dbc8c5
    cat <<EOF >&2
dbc8c5
The datadir located at $datadir needs to be upgraded using 'mysql_upgrade' tool. This can be done using the following steps:
dbc8c5
dbc8c5
  1. Back-up your data before with 'mysql_upgrade'
dbc8c5
  2. Start the database daemon using 'service @DAEMON_NAME@ start'
dbc8c5
  3. Run 'mysql_upgrade' with a database user that has sufficient privileges
dbc8c5
dbc8c5
Read more about 'mysql_upgrade' usage at:
dbc8c5
http://dev.mysql.com/doc/refman/5.6/en/mysql-upgrade.html
dbc8c5
EOF
dbc8c5
fi
dbc8c5
dbc8c5
exit 0