Prevent multiple PATH entries in file /etc/profile.
Fix some errors if if the installation version is the same as the already installed version.
This commit is contained in:
parent
d3854f01d7
commit
7e9aa69656
@ -591,7 +591,7 @@ echo ""
|
|||||||
## -
|
## -
|
||||||
if [ -d $logdir ]; then
|
if [ -d $logdir ]; then
|
||||||
echononl "Verschiebe exitierendes Logverzeichnis ..."
|
echononl "Verschiebe exitierendes Logverzeichnis ..."
|
||||||
mv ${logdir $logdir}.$_backup_date
|
mv "$logdir" "${logdir}.$_backup_date"
|
||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
echo_ok
|
echo_ok
|
||||||
else
|
else
|
||||||
@ -1292,21 +1292,23 @@ if $SYMLINK_INITSCRIPT ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echononl "Füge `dirname $MYSQL_INSTALL_DIR`/mysql/bin zur PATH Variable hinzu .."
|
_checkdir="$(dirname "$MYSQL_INSTALL_DIR")/mysql/bin"
|
||||||
|
echononl "Füge '$_checkdir' zur PATH Variable hinzu .."
|
||||||
if [ -f /etc/profile ]; then
|
if [ -f /etc/profile ]; then
|
||||||
_mysql_bin_dir="`dirname $MYSQL_INSTALL_DIR`/mysql/bin"
|
if ! grep -e "$_checkdir" /etc/profile > /dev/null 2<&1 ; then
|
||||||
if ! grep -e "PATH=.*$_mysql_bin_dir" /etc/profile > /dev/null 2<&1 ; then
|
|
||||||
echo "" >> ${logdir}/main.log
|
echo "" >> ${logdir}/main.log
|
||||||
echo "perl -i -n -p -e \"s#^([ ]*export[ ]*PATH.*$)#check_dir=\$_mysql_bin_dir\nif [ -d \\\"\\\\\\\$check_dir\\\" ];then\n PATH=\\\\\\\${check_dir}:\\\\\\\$PATH\nfi\n\n\1#\" /etc/profile" >> ${logdir}/main.log 2<&1
|
echo "perl -i -n -p -e \"s#^([ ]*export[ ]*PATH.*$)#check_dir=\$_checkdir\nif [ -d \\\"\\\\\\\$check_dir\\\" ];then\n PATH=\\\\\\\${check_dir}:\\\\\\\$PATH\nfi\n\n\1#\" /etc/profile" >> ${logdir}/main.log 2<&1
|
||||||
perl -i -n -p -e "s#^([ ]*export[ ]*PATH.*$)#check_dir=$_mysql_bin_dir\nif [ -d \"\\\$check_dir\" ];then\n PATH=\\\${check_dir}:\\\$PATH\nfi\n\n\1#" /etc/profile >> ${logdir}/main.log 2<&1
|
|
||||||
|
perl -i -n -p -e "s#^([ ]*export[ ]*PATH.*$)#check_dir=$_checkdir\nif [ -d \"\\\$check_dir\" ];then\n PATH=\\\${check_dir}:\\\$PATH\nfi\n\n\1#" /etc/profile >> ${logdir}/main.log 2<&1
|
||||||
|
|
||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
echo_ok
|
echo_ok
|
||||||
else
|
else
|
||||||
echo_failed
|
echo_failed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! echo "$PATH" | grep $_mysql_bin_dir >> ${logdir}/main.log 2>&1 ; then
|
if ! echo "$PATH" | grep $_checkdir >> ${logdir}/main.log 2>&1 ; then
|
||||||
export PATH=${_mysql_bin_dir}:$PATH
|
export PATH=${_checkdir}:$PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -1438,9 +1440,11 @@ _new_cnf_needed=false
|
|||||||
if $UPDATE_MYSQL ; then
|
if $UPDATE_MYSQL ; then
|
||||||
echononl "Copy 'my.cnf from old installation to the new one.."
|
echononl "Copy 'my.cnf from old installation to the new one.."
|
||||||
echo "" >> ${logdir}/main.log
|
echo "" >> ${logdir}/main.log
|
||||||
echo "cp -a \"$(realpath ${MYSQL_CUR_INSTALL_DIR}/my.cnf)\" \"${MYSQL_INSTALL_DIR}/my.cnf\"" >> ${logdir}/main.log
|
if [[ "$CURRENT_VERSION" = "$MYSQL_VERSION" ]] ; then
|
||||||
if [[ -f "${MYSQL_CUR_INSTALL_DIR}/my.cnf" ]] ; then
|
echo "cp -a \"$(realpath ${MYSQL_CUR_INSTALL_DIR}).${_backup_date}/my.cnf\" \"${MYSQL_INSTALL_DIR}/my.cnf\"" \
|
||||||
cp -a "$(realpath ${MYSQL_CUR_INSTALL_DIR}/my.cnf)" "${MYSQL_INSTALL_DIR}/my.cnf" >> ${logdir}/main.log
|
>> ${logdir}/main.log
|
||||||
|
cp -a "$(realpath ${MYSQL_CUR_INSTALL_DIR}).${_backup_date}/my.cnf" "${MYSQL_INSTALL_DIR}/my.cnf" \
|
||||||
|
>> ${logdir}/main.log 2>&1
|
||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
echo_ok
|
echo_ok
|
||||||
else
|
else
|
||||||
@ -1449,7 +1453,20 @@ if $UPDATE_MYSQL ; then
|
|||||||
error "Konnte Konfigurationsdatei 'my.cnf' nicht vom alten in das neue Installations Verz.kopieren.."
|
error "Konnte Konfigurationsdatei 'my.cnf' nicht vom alten in das neue Installations Verz.kopieren.."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo_skipped
|
echo "cp -a \"$(realpath ${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 2>&1
|
||||||
|
if [ "$?" = "0" ]; then
|
||||||
|
echo_ok
|
||||||
|
else
|
||||||
|
echo_failed
|
||||||
|
_new_cnf_needed=true
|
||||||
|
error "Konnte Konfigurationsdatei 'my.cnf' nicht vom alten in das neue Installations Verz.kopieren.."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "${MYSQL_INSTALL_DIR}/my.cnf" ]] ; then
|
||||||
_new_cnf_needed=true
|
_new_cnf_needed=true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -2394,6 +2411,8 @@ else
|
|||||||
error Konnte MySQL Datenbankserver nicht starten..
|
error Konnte MySQL Datenbankserver nicht starten..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
if ! $UPDATE_MYSQL ; then
|
if ! $UPDATE_MYSQL ; then
|
||||||
|
|
||||||
## - Delete rows with empty 'User' from table mysql.user
|
## - Delete rows with empty 'User' from table mysql.user
|
||||||
@ -2456,11 +2475,11 @@ _sys_maint_cnf_needed=false
|
|||||||
if $UPDATE_MYSQL ; then
|
if $UPDATE_MYSQL ; then
|
||||||
echononl "Copy 'sys-maint.cnf from old installation to the new one.."
|
echononl "Copy 'sys-maint.cnf from old installation to the new one.."
|
||||||
echo "" >> ${logdir}/main.log
|
echo "" >> ${logdir}/main.log
|
||||||
echo "cp -a \"$(realpath ${MYSQL_CUR_INSTALL_DIR}/sys-maint.cnf)\" \"${MYSQL_INSTALL_DIR}/sys-maint.cnf\"" \
|
if [[ "$CURRENT_VERSION" = "$MYSQL_VERSION" ]] ; then
|
||||||
>> ${logdir}/main.log
|
echo "cp -a \"$MYSQL_INSTALL_DIR.$_backup_date/sys-maint.cnf\" \"${MYSQL_INSTALL_DIR}/sys-maint.cnf\"" \
|
||||||
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
|
>> ${logdir}/main.log
|
||||||
|
cp -a $MYSQL_INSTALL_DIR.$_backup_date/sys-maint.cnf "${MYSQL_INSTALL_DIR}/sys-maint.cnf" \
|
||||||
|
>> ${logdir}/main.log 2>&1
|
||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
echo_ok
|
echo_ok
|
||||||
else
|
else
|
||||||
@ -2469,6 +2488,20 @@ if $UPDATE_MYSQL ; then
|
|||||||
error "Konnte Konfigurationsdatei 'sys-maint.cnf' nicht vom alten in das neue Installations Verz.kopieren.."
|
error "Konnte Konfigurationsdatei 'sys-maint.cnf' nicht vom alten in das neue Installations Verz.kopieren.."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
echo "cp -a \"$(realpath ${MYSQL_CUR_INSTALL_DIR}/sys-maint.cnf)\" \"${MYSQL_INSTALL_DIR}/sys-maint.cnf\"" \
|
||||||
|
>> ${logdir}/main.log
|
||||||
|
cp -a "$(realpath ${MYSQL_CUR_INSTALL_DIR}/sys-maint.cnf)" "${MYSQL_INSTALL_DIR}/sys-maint.cnf" \
|
||||||
|
>> ${logdir}/main.log 2>&1
|
||||||
|
if [ "$?" = "0" ]; then
|
||||||
|
echo_ok
|
||||||
|
else
|
||||||
|
echo_failed
|
||||||
|
_sys_maint_cnf_needed=true
|
||||||
|
error "Konnte Konfigurationsdatei 'sys-maint.cnf' nicht vom alten in das neue Installations Verz.kopieren.."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -f "${MYSQL_INSTALL_DIR}/sys-maint.cnf" ]] ; then
|
||||||
_sys_maint_cnf_needed=true
|
_sys_maint_cnf_needed=true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user