Fix error on update_mode.

This commit is contained in:
Christoph 2017-09-26 15:00:40 +02:00
parent 4f61ae3788
commit 802fed424b

View File

@ -28,6 +28,7 @@ _required_debian_packages="libevent-dev
libpcre3-dev
default-jdk"
_CRONTAB_BAKUP_FILE="$(mktemp)"
## - Let make use multiple cores (-j<number of cores +1>)
## -
@ -36,6 +37,16 @@ export MAKEFLAGS=-j$(expr `grep "^processor" /proc/cpuinfo | sort -u | wc -l` +
## --- Some functions
## ---
clean_up() {
# Perform program exit housekeeping
if [[ -s "$_CRONTAB_BAKUP_FILE" ]]; then
crontab -u root $_CRONTAB_BAKUP_FILE
fi
rm -f $_CRONTAB_BAKUP_FILE
exit $1
}
echononl(){
echo X\\c > /tmp/shprompt$$
if [ `wc -c /tmp/shprompt$$ | awk '{print $1}'` -eq 1 ]; then
@ -52,7 +63,7 @@ fatal(){
echo ""
echo -e "\t\033[31m\033[1mInstalllation wird abgebrochen\033[m\033[m"
echo ""
exit 1
clean_up 1
}
error(){
@ -82,6 +93,8 @@ echo_skipped() {
## ---
## --- END: functions
trap clean_up SIGHUP SIGINT SIGTERM
_curdir=`pwd`
@ -666,6 +679,29 @@ fi
echo ""
## - Disable crontab for user root
## -
echononl "Backup crontab"
echo "" >> ${logdir}/main.log
echo "crontab -u root -l > $_CRONTAB_BAKUP_FILE" >> ${logdir}/main.log
crontab -u root -l >> $_CRONTAB_BAKUP_FILE 2>> ${logdir}/main.log
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
echononl "Disable crontab for user root"
echo "" >> ${logdir}/main.log
echo "crontab -r -u root" >> ${logdir}/main.log
crontab -r -u root >> ${logdir}/main.log 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
## - Stop MySQL Service if running
## -
echononl "Stop MySQL Service.."
@ -704,7 +740,7 @@ else
echo_skipped
fi
echo ""
echononl "Verschiebe exitierendes MySQL Datenbank-Verzeichnis ..."
if [ -d $MYSQL_DATA_DIR ]; then
echo "" >> ${logdir}/main.log
@ -983,21 +1019,6 @@ else
fi
#if [ -d "${MYSQL_SRC_BASE_DIR}/mysql-$MYSQL_VERSION" ];then
# echononl "Verschiebe exitierendes Sourceverzeichnis ..."
# echo "" >> ${logdir}/main.log
# echo "mv ${MYSQL_SRC_BASE_DIR}/mysql-$MYSQL_VERSION ${MYSQL_SRC_BASE_DIR}/mysql-$MYSQL_VERSION.`date +\"%Y%m%d-%H%M\"`" >> ${logdir}/main.log
# mv ${MYSQL_SRC_BASE_DIR}/mysql-$MYSQL_VERSION ${MYSQL_SRC_BASE_DIR}/mysql-$MYSQL_VERSION.`date +"%Y%m%d-%H%M"` \
# >> ${logdir}/main.log 2>&1
# if [ "$?" = "0" ]; then
# echo_ok
# else
# echo_failed
# fatal Kann Sourceverzeichnis \"${MYSQL_SRC_BASE_DIR}/mysql-$MYSQL_VERSION\" nicht verschieben..
# fi
#fi
if [ -d "${MYSQL_SRC_DIR}" ];then
echononl "Verschiebe exitierendes Sourceverzeichnis ..."
echo "" >> ${logdir}/main.log
@ -1046,11 +1067,21 @@ if [ -d ${MYSQL_INSTALL_DIR} ];then
fi
fi
# - Note:
# -
# - Since MySQL v 5.7.16 the default 'secure_file_priv' value has changed
# -
# - NULL (>= MySQL 5.7.16), empty (< MySQL 5.7.16)
# -
# - We change the default to empty ("") with -D INSTALL_SECURE_FILE_PRIVDIR="" option
# -
echononl "Konfiguriere MySQL (cmake).."
echo "" >> ${logdir}/main.log
echo "cmake -D CMAKE_INSTALL_PREFIX=$MYSQL_INSTALL_DIR -D MYSQL_DATADIR=$MYSQL_DATA_DIR . -DDOWNLOAD_BOOST=1 -DWITH_BOOST=$MYSQL_INSTALL_DIR" >> ${logdir}/main.log
cmake -D CMAKE_INSTALL_PREFIX=$MYSQL_INSTALL_DIR \
-D MYSQL_DATADIR=$MYSQL_DATA_DIR . \
echo "cmake -DCMAKE_INSTALL_PREFIX=$MYSQL_INSTALL_DIR -DMYSQL_DATADIR=$MYSQL_DATA_DIR . -DINSTALL_SECURE_FILE_PRIVDIR="" -DENABLED_LOCAL_INFILE=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=$MYSQL_INSTALL_DIR" >> ${logdir}/main.log
cmake -DCMAKE_INSTALL_PREFIX=$MYSQL_INSTALL_DIR \
-DMYSQL_DATADIR=$MYSQL_DATA_DIR . \
-DINSTALL_SECURE_FILE_PRIVDIR=\"\" \
-DENABLED_LOCAL_INFILE=1 \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=$MYSQL_INSTALL_DIR > ${logdir}/cmake-conf.log 2>&1
if [ "$?" = "0" ]; then
@ -1388,9 +1419,9 @@ _new_cnf_needed=false
if $UPDATE_MYSQL ; then
echononl "Copy 'my.cnf from old installation to the new one.."
echo "" >> ${logdir}/main.log
echo "cp -a \"${MYSQL_CUR_INSTALL_DIR}/my.cnf\" \"${MYSQL_INSTALL_DIR}/my.cnf\"" >> ${logdir}/main.log
echo "cp -a \"$( realpath ${MYSQL_CUR_INSTALL_DIR}/my.cnf)\" \"${MYSQL_INSTALL_DIR}/my.cnf\"" >> ${logdir}/main.log
if [[ -f "${MYSQL_CUR_INSTALL_DIR}/my.cnf" ]] ; then
cp -a "${MYSQL_CUR_INSTALL_DIR}/my.cnf" "${MYSQL_INSTALL_DIR}/my.cnf" >> ${logdir}/main.log
cp -a "$(realpath ${MYSQL_CUR_INSTALL_DIR}/my.cnf)" "${MYSQL_INSTALL_DIR}/my.cnf" >> ${logdir}/main.log
if [ "$?" = "0" ]; then
echo_ok
else
@ -1455,6 +1486,53 @@ innodb_open_files = `ulimit -Hn`
port = $MYSQL_PORT
socket = $MYSQL_UNIX_SOCKET
## - secure-file-priv
## -
## - This variable is used to limit the effect of data import and export operations,
## - such as those performed by the LOAD DATA and SELECT ... INTO OUTFILE statements
## - and the LOAD_FILE() function. These operations are permitted only to users who
## - have the FILE privilege.
## -
## - i.e.: GRANT FILE on *.* to piwik@localhost
## -
## - secure_file_priv may be set as follows:
## -
## - - If empty, the variable has no effect. (That means no restrictions).
## - This is not a secure setting.
## - - If set to the name of a directory, the server limits import and export
## - operations to work only with files in that directory. The directory
## - must exist; the server will not create it.
## - - If set to NULL, the server disables import and export operations.
## - This value is permitted as of MySQL 5.7.6.
## -
## - Since MySQL v 5.7.16 the default 'secure_file_priv' value has changed
## -
## - NULL (>= MySQL 5.7.16), empty (< MySQL 5.7.16)
## -
## - We use empty ("")
## -
## - Note:
## - We changed the default to empty ("") while building from source
## - using CMake option (-DINSTALL_SECURE_FILE_PRIVDIR=""). So you can ignore
## - this option.
## -
#secure-file-priv = ""
## - local-infile
## -
## - This variable controls server-side LOCAL capability for LOAD DATA statements.
## - Depending on the local_infile setting, the server refuses or permits local data
## - loading by clients that have LOCAL enabled on the client side.
## -
## - You can check your 'local-infile' setting on mysql prompt:
## -
## - SHOW GLOBAL VARIABLES LIKE 'local_infile';
## -
#local-infile = 1
## - skip_external_locking
## -
## - Affects only MyISAM table access.
@ -2135,6 +2213,7 @@ max_allowed_packet = 32M
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
local-infile = 1
[myisamchk]
key_buffer_size = 256M
@ -2178,13 +2257,18 @@ EOF
error Konnte Konfigurationsdatei \"${MYSQL_INSTALL_DIR}/my.cnf\" nicht erstellen..
fi
echononl "Kopiere \"stopwords_utf8_iso8859-15.txt\" -> ${MYSQL_INSTALL_DIR}.."
if [ -f "${MYSQL_SRC_BASE_DIR}/stopwords_utf8_iso8859-15.txt" ];then
cp ${MYSQL_SRC_BASE_DIR}/stopwords_utf8_iso8859-15.txt ${MYSQL_INSTALL_DIR}
if [ "$?" = "0" ]; then
echo_ok
fi
echononl "Aktiviere Stopword Datei.."
echononl "Kopiere \"stopwords_utf8_iso8859-15.txt\" -> ${MYSQL_INSTALL_DIR}.."
if [ -f "${MYSQL_SRC_BASE_DIR}/stopwords_utf8_iso8859-15.txt" ];then
echo "" >> ${logdir}/main.log
echo "cp ${MYSQL_SRC_BASE_DIR}/stopwords_utf8_iso8859-15.txt ${MYSQL_INSTALL_DIR}" >> ${logdir}/main.log
cp ${MYSQL_SRC_BASE_DIR}/stopwords_utf8_iso8859-15.txt ${MYSQL_INSTALL_DIR}
if [ "$?" = "0" ]; then
echo_ok
echononl "Aktiviere Stopword Datei.."
if ! grep -q -E "^\s*ft_stopword_file.*" "${MYSQL_INSTALL_DIR}/my.cnf" 2> /dev/null ; then
echo "" >> ${logdir}/main.log
echo "perl -i -n -p -e \"s/^(\s*#\s*)(ft_stopword_file.*)/#\1\2\n\2/\" /usr/local/mysql/my.cnf" >> ${logdir}/main.log
perl -i -n -p -e "s/^(\s*#\s*)(ft_stopword_file.*)/#\1\2\n\2/" /usr/local/mysql/my.cnf >> ${logdir}/main.log 2>&1
@ -2194,16 +2278,17 @@ EOF
echo_failed
warn "Konnte Stopword Datei \"stopwords_utf8_iso8859-15.txt\" nicht aktivieren."
fi
else
echo_failed
warn "Konnte stopwords_utf8_iso8859-15.txt nicht nach ${MYSQL_INSTALL_DIR} kopieren"
echo_skipped
fi
else
echo_skipped
warn "Konnte ${MYSQL_SRC_BASE_DIR}/stopwords_utf8_iso8859-15.txt finden."
fi
else
echo_failed
warn "Konnte stopwords_utf8_iso8859-15.txt nicht nach ${MYSQL_INSTALL_DIR} kopieren"
fi
else
echo_skipped
warn "Konnte ${MYSQL_SRC_BASE_DIR}/stopwords_utf8_iso8859-15.txt finden."
fi
#echononl "Kopiere Startscript nach /etc/init.d/mysql.server.."
@ -2341,9 +2426,11 @@ _sys_maint_cnf_needed=false
if $UPDATE_MYSQL ; then
echononl "Copy 'sys-maint.cnf from old installation to the new one.."
echo "" >> ${logdir}/main.log
echo "cp -a \"${MYSQL_CUR_INSTALL_DIR}/sys-maint.cnf\" \"${MYSQL_INSTALL_DIR}/sys-maint.cnf\"" >> ${logdir}/main.log
if [[ -f "${MYSQL_CUR_INSTALL_DIR}/my.cnf" ]] ; then
cp -a "${MYSQL_CUR_INSTALL_DIR}/my.cnf" "${MYSQL_INSTALL_DIR}/my.cnf" >> ${logdir}/main.log
echo "cp -a \"$(realpath ${MYSQL_CUR_INSTALL_DIR}/sys-maint.cnf)\" \"${MYSQL_INSTALL_DIR}/sys-maint.cnf\"" \
>> ${logdir}/main.log
if [[ -f "${MYSQL_CUR_INSTALL_DIR}/sys-maint.cnf" ]] ; then
cp -a "$(realpath ${MYSQL_CUR_INSTALL_DIR}/sys-maint.cnf)" "${MYSQL_INSTALL_DIR}/sys-maint.cnf" \
>> ${logdir}/main.log
if [ "$?" = "0" ]; then
echo_ok
else
@ -2464,6 +2551,27 @@ else
error Konnte Logrotate Definitionsdatei \"/etc/logrotate.d/mysql\" nicht erstellen..
fi
echo
echononl "Enable crontab for user root"
echo "" >> ${logdir}/main.log
echo "crontab -u root $_CRONTAB_BAKUP_FILE" >> ${logdir}/main.log
crontab -u root $_CRONTAB_BAKUP_FILE >> ${logdir}/main.log 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
echononl "Remove crontab backup file"
echo "" >> ${logdir}/main.log
echo "rm $_CRONTAB_BAKUP_FILE" >> ${logdir}/main.log
rm -f $_CRONTAB_BAKUP_FILE
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
echo
exit 0
clean_up 0