ソースを参照

* configurarSQL(): configuración de MySQL y MariaDB para Moodle
* Cambios de algunas cadenas de texto

Guzmán Castanedo Villalba 5 年 前
コミット
35955119b7
1 ファイル変更52 行追加1 行削除
  1. 52 1
      install

+ 52 - 1
install

@@ -114,6 +114,13 @@ comprobarError() {
 		212)
 			error="\n$type $codeNum:\tImposible recargar base de datos."
 			;;
+		213)
+			error="\n$type $codeNum:\tImposible configurar SQL.\n"
+			;;
+		214)
+			type="WARNING"
+			error="\n$type $codeNum:\tSQL ya está configurado."
+			;;
 		300)
 			error="\n$type $codeNum:\tError interno (instalación PHP-7.2).\n"
 			;;
@@ -946,6 +953,7 @@ instalarMySQL() {
 	else
 		comprobarError 1 203
 	fi
+	deshabilitarServicio $sqlServerName
 }
 
 instalarMariaDB() {
@@ -959,6 +967,42 @@ instalarMariaDB() {
 	else
 		comprobarError 1 204
 	fi
+	deshabilitarServicio $sqlServerName
+}
+
+configurarSQL() {
+	# Configura MariaDB o MySQL
+	if [ $mariaDBOn = true ] && [ $debianOS = true ];then
+		sqlConfFile="/etc/mysql/my.cnf"
+	elif [ $mariaDBOn = true ] && [ $rhelOS = true ];then
+		sqlConfFile="/etc/my.cnf"
+	elif [ $mySQLOn = true ] && [ $debianOS = true ];then
+		sqlConfFile="/etc/mysql/my.cnf"
+	else
+		comprobarError 1 213
+	fi
+	if [ ! -f $sqlConfFile ];then
+		comprobarError 1 213
+	fi
+	grep "# Configuration for Moodle" $sqlConfFile >/dev/null 2>&1
+	if [ $? -ne 0];then
+		# Establecemos UTF8 (codificación de caracteres) y Barracuda (sistema de ficheros)
+		echo -en "\n# Configuration for Moodle\n" >> $sqlConfFile
+		echo -en "[client]\n" >> $sqlConfFile
+		echo -en "default-character-set = utf8mb4\n\n" >> $sqlConfFile
+		echo -en "[mysqld]\n" >> $sqlConfFile
+		echo -en "innodb_file_format = Barracuda\n" >> $sqlConfFile
+		echo -en "innodb_file_per_table = 1\n" >> $sqlConfFile
+		echo -en "innodb_large_prefix\n\n" >> $sqlConfFile
+		echo -en "character-set-server = utf8mb4\n" >> $sqlConfFile
+		echo -en "collation-server = utf8mb4_unicode_ci\n" >> $sqlConfFile
+		echo -en "skip-character-set-client-handshake\n\n" >> $sqlConfFile
+		echo -en "[mysql]\n" >> $sqlConfFile
+		echo -en "default-character-set = utf8mb4\n" >> $sqlConfFile
+	else
+		comprobarError 1 214
+	fi
+	unset sqlConfFile
 }
 
 instalarPHP() {
@@ -1471,8 +1515,15 @@ mostrarExpress
 	fi
 # Configuración Database (Arrancar Base de Datos, establecer contraseña y configuración segura)
 	if [ $mySQLOn = true ] || [ $mariaDBOn = true ];then
+		echo -en "Configurando Base de Datos..." | tee -a $logFile
+#		{
+#			echo -en "%s\n" $((100 * progreso / progresoTotal))
+			configurarSQL
+			progreso=$((progreso + 1))
+#		} > >(whiptail --gauge "Configurando Base de Datos MySQL..." $((ALTO * 4 / 10)) $((ANCHO * 9 / 10)) $((100 * progreso / progresoTotal)))
+		echo -en " OK.\n" | tee -a $logFile
 		habilitarServicio "$sqlServerName"
-		echo -en "Configurando Base de Datos MySQL..." | tee -a $logFile
+		echo -en "Estableciendo contraseña de la Base de Datos..." | tee -a $logFile
 #		{
 #			echo -en "%s\n" $((100 * progreso / progresoTotal))
 			establecerSQLPasswd