From 1f22cb99d949fecb8874e66005983b9401db0889 Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 2 Mar 2020 00:26:54 +0100 Subject: [PATCH] install_mysql.sh: if cmake fails downloading boost-archive, try to download the boost-archive directly. In case of success, continue installation. --- install_mysql.sh | 192 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 146 insertions(+), 46 deletions(-) diff --git a/install_mysql.sh b/install_mysql.sh index 4028a5a..12d2f08 100755 --- a/install_mysql.sh +++ b/install_mysql.sh @@ -2094,61 +2094,67 @@ else fi -#echo "" -#echo "shell> mkdir \"$MYSQL_INSTALL_DIR\"" -#echo "shell> \"cp $MYSQL_SRC_BASE_DIR/boost_1_59_0.tar.gz\" \"$MYSQL_INSTALL_DIR\"" -#echo "" -#sleep 120 +# Prevent cmake from downloading 'boost' archive, if it is already +# present. +# +# if cmake finds the apropriate 'boost' archive in the installation directory +# cmake wil take this one. +# +if [[ "${MYSQL_DISTRIBUTION,,}" = "mysql" ]] ; then -BOOST_ARCHIV="$(grep "SET(BOOST_PACKAGE_NAME" ${MYSQL_SRC_DIR}/cmake/boost.cmake \ - | grep -o -w -E "boost_[0-9]{1,2}_[0-9]{1,2}_[0-9]{1,2}").tar.gz" + BOOST_ARCHIV="$(grep "SET(BOOST_PACKAGE_NAME" ${MYSQL_SRC_DIR}/cmake/boost.cmake \ + | grep -o -w -E "boost_[0-9]{1,2}_[0-9]{1,2}_[0-9]{1,2}").tar.gz" -if [[ -f "${MYSQL_SRC_BASE_DIR}/$BOOST_ARCHIV" ]] ; then + BOOST_VERSION="$(echo $BOOST_ARCHIV | grep -o -E "[0-9]{1,2}_[0-9]{1,2}_[0-9]{1,2}" | tr "_" "\." )" - echononl "Erstelle Installations Verzeichnis '$(basename $MYSQL_INSTALL_DIR)'.." - echo "" >> ${logdir}/main.log - echo "## - Erstelle Installations Verzeichnis '$(basename $MYSQL_INSTALL_DIR)'" >> ${logdir}/main.log - echo "## -" >> ${logdir}/main.log - echo "mkdir $MYSQL_INSTALL_DIR" >> ${logdir}/main.log - mkdir "$MYSQL_INSTALL_DIR" >> ${logdir}/main.log 2>&1 - if [[ $? -ne 0 ]] ; then - echo_failed + if [[ -f "${MYSQL_SRC_BASE_DIR}/$BOOST_ARCHIV" ]] ; then - error Erstellen des Installations Verzeichnisses $MYSQL_INSTALL_DIR ist fehlgeschlagen.. + echononl "Erstelle Installations Verzeichnis '$(basename $MYSQL_INSTALL_DIR)'.." + echo "" >> ${logdir}/main.log + echo "## - Erstelle Installations Verzeichnis '$(basename $MYSQL_INSTALL_DIR)'" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "mkdir $MYSQL_INSTALL_DIR" >> ${logdir}/main.log + mkdir "$MYSQL_INSTALL_DIR" >> ${logdir}/main.log 2>&1 + if [[ $? -ne 0 ]] ; then + echo_failed - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " + error Erstellen des Installations Verzeichnisses $MYSQL_INSTALL_DIR ist fehlgeschlagen.. + + echononl "continue anyway [yes/no]: " read OK - done - [[ $OK = "yes" ]] || fatal "Abbruch durch User" - else - echo_ok - fi + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Abbruch durch User" + else + echo_ok + fi - echononl "Kopiere '$BOOST_ARCHIV' nach '$(basename $MYSQL_INSTALL_DIR)'.." - echo "" >> ${logdir}/main.log - echo "## - Kopiere '$BOOST_ARCHIV' nach '$(basename $MYSQL_INSTALL_DIR)'.." >> ${logdir}/main.log - echo "## -" >> ${logdir}/main.log - echo "cp \"${MYSQL_SRC_BASE_DIR}/$BOOST_ARCHIV\" \"$MYSQL_INSTALL_DIR)\"" >> ${logdir}/main.log - cp "${MYSQL_SRC_BASE_DIR}/$BOOST_ARCHIV" "$MYSQL_INSTALL_DIR" >> ${logdir}/main.log 2>&1 - if [[ $? -ne 0 ]] ; then - echo_failed + echononl "Kopiere '$BOOST_ARCHIV' nach '$(basename $MYSQL_INSTALL_DIR)'.." + echo "" >> ${logdir}/main.log + echo "## - Kopiere '$BOOST_ARCHIV' nach '$(basename $MYSQL_INSTALL_DIR)'.." >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "cp \"${MYSQL_SRC_BASE_DIR}/$BOOST_ARCHIV\" \"$MYSQL_INSTALL_DIR)\"" >> ${logdir}/main.log + cp "${MYSQL_SRC_BASE_DIR}/$BOOST_ARCHIV" "$MYSQL_INSTALL_DIR" >> ${logdir}/main.log 2>&1 + if [[ $? -ne 0 ]] ; then + echo_failed - error "Kann '$BOOST_ARCHIV' nicht in das Installations Verzeichniss '$MYSQL_INSTALL_DIR' kopieren.." + error "Kann '$BOOST_ARCHIV' nicht in das Installations Verzeichniss '$MYSQL_INSTALL_DIR' kopieren.." - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " + echononl "continue anyway [yes/no]: " read OK - done - [[ $OK = "yes" ]] || fatal "Abbruch durch User" - else - echo_ok + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Abbruch durch User" + else + echo_ok + fi + fi fi @@ -2261,7 +2267,101 @@ if [ "$?" = "0" ]; then echo_ok else echo_failed - fatal Konfiguration fehlgeschlagen. Siehe ${logdir}/cmake-conf.log .. + + if [[ "${MYSQL_DISTRIBUTION,,}" = "mysql" ]] \ + && $(grep "\-\- Download failed" ${logdir}/cmake-conf.log > /dev/null 2>&1) ; then + + error "It seems downloading $BOOST_ARCHIV failed." + + echononl "Try to download '$BOOST_ARCHIV' directly.." + echo "" >> ${logdir}/main.log + echo "# - Try to download '$BOOST_ARCHIV' directly.." >> ${logdir}/main.log + echo "# -" >> ${logdir}/main.log + echo "wget -O \"${MYSQL_SRC_BASE_DIR}/$BOOST_ARCHIV\" \\" >> ${logdir}/main.log + echo " https://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/${BOOST_ARCHIV}" >> ${logdir}/main.log + + wget -O "${MYSQL_SRC_BASE_DIR}/$BOOST_ARCHIV" \ + https://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/${BOOST_ARCHIV} >> ${logdir}/main.log 2>&1 + if [[ $? -eq 0 ]]; then + + echo_ok + + echononl "Erstelle Installations Verzeichnis '$(basename $MYSQL_INSTALL_DIR)'.." + if [[ -d "$MYSQL_INSTALL_DIR" ]]; then + echo_skipped + else + echo "" >> ${logdir}/main.log + echo "## - Erstelle Installations Verzeichnis '$(basename $MYSQL_INSTALL_DIR)'" >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "mkdir $MYSQL_INSTALL_DIR" >> ${logdir}/main.log + mkdir "$MYSQL_INSTALL_DIR" >> ${logdir}/main.log 2>&1 + if [[ $? -ne 0 ]] ; then + echo_failed + + error Erstellen des Installations Verzeichnisses $MYSQL_INSTALL_DIR ist fehlgeschlagen.. + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Abbruch durch User" + else + echo_ok + fi + fi + + echononl "Kopiere '$BOOST_ARCHIV' nach '$(basename $MYSQL_INSTALL_DIR)'.." + echo "" >> ${logdir}/main.log + echo "## - Kopiere '$BOOST_ARCHIV' nach '$(basename $MYSQL_INSTALL_DIR)'.." >> ${logdir}/main.log + echo "## -" >> ${logdir}/main.log + echo "cp \"${MYSQL_SRC_BASE_DIR}/$BOOST_ARCHIV\" \"$MYSQL_INSTALL_DIR)\"" >> ${logdir}/main.log + cp "${MYSQL_SRC_BASE_DIR}/$BOOST_ARCHIV" "$MYSQL_INSTALL_DIR" >> ${logdir}/main.log 2>&1 + if [[ $? -ne 0 ]] ; then + echo_failed + + error "Kann '$BOOST_ARCHIV' nicht in das Installations Verzeichniss '$MYSQL_INSTALL_DIR' kopieren.." + + echononl "continue anyway [yes/no]: " + read OK + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Abbruch durch User" + else + echo_ok + fi + + echononl "Nochmal: konfiguriere MySQL (cmake).." + echo_wait + echo "" >> ${logdir}/main.log + echo "# - Nochml: konfiguriere MySQL (cmake).." >> ${logdir}/main.log + echo "# -" >> ${logdir}/main.log + echo "# - See ${logdir}/cmake-conf.log" >> ${logdir}/main.log + echo "# -" >> ${logdir}/main.log + echo "cmake \$cmake_options " >> ${logdir}/main.log + cmake $cmake_options > ${logdir}/cmake-conf.log 2>&1 + if [ "$?" = "0" ]; then + echo_ok + echo "" + else + echo_failed + rm -rf "${MYSQL_SRC_BASE_DIR}/$BOOST_ARCHIV" + fatal Konfiguration erneut fehlgeschlagen. Siehe ${logdir}/cmake-conf.log .. + fi + + else + echo_failed + fatal "Downloading '$BOOST_ARCHIV' directly failed" + fi + + else + fatal Konfiguration fehlgeschlagen. Siehe ${logdir}/cmake-conf.log .. + fi fi echononl "Kompiliere MySQL.."