Blame SOURCES/mysql-check-upgrade.sh

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