|
@@ -484,6 +484,8 @@ inicializarVariables() {
|
|
|
phpFPMName=""
|
|
|
nombreMediaWiki=""
|
|
|
dominioMediaWiki=""
|
|
|
+ nombreMoodle=""
|
|
|
+ dominioMoodle=""
|
|
|
}
|
|
|
|
|
|
instalacionExpress() {
|
|
@@ -587,6 +589,7 @@ mostrarComponentes() {
|
|
|
;;
|
|
|
\"Moodle\")
|
|
|
moodleOn=true
|
|
|
+ mostrarMoodle
|
|
|
progresoTotal=$((progresoTotal + 2))
|
|
|
;;
|
|
|
\"InfoPHP\")
|
|
@@ -672,7 +675,37 @@ mostrarMediaWiki(){
|
|
|
control=true
|
|
|
fi
|
|
|
done
|
|
|
- unset control error passwdMediaWiki2 cont serverName
|
|
|
+ unset control error passwdMediaWiki2 dominio cont serverName
|
|
|
+}
|
|
|
+
|
|
|
+mostrarMoodle() {
|
|
|
+ # Introducir nombre Moodle
|
|
|
+ while [ -z "$nombreMoodle" ]; do
|
|
|
+ nombreMoodle=$(whiptail --title "CONFIGURACION MOODLE" --inputbox "Introduzca el nombre del campus virtual:" $((ALTO * 9 / 10)) $((ANCHO * 9 / 10)) --ok-button "Continuar" --cancel-button "Salir" 3>&1 1>&2 2>&3)
|
|
|
+ comprobarError $? 1
|
|
|
+ # Mejora: comprobar si el dominio ya está en uso
|
|
|
+ done
|
|
|
+ # Introducir dominio
|
|
|
+ while [ -z "$dominioMoodle" ]; do
|
|
|
+ dominioMoodle=$(whiptail --title "CONFIGURACION MOODLE" --inputbox "Introduzca el dominio/subdominio del campus virtual.\nMoodle SÓLO permite un ÚNICO DOMINIO." $((ALTO * 9 / 10)) $((ANCHO * 9 / 10)) moodle.$hostname --ok-button "Continuar" --cancel-button "Salir" 3>&1 1>&2 2>&3)
|
|
|
+ comprobarError $? 1
|
|
|
+ # Mejora: comprobar si el dominio ya está en uso
|
|
|
+ done
|
|
|
+ cont=1
|
|
|
+ serverName=""
|
|
|
+ aliasMoodle=""
|
|
|
+ for dominio in $dominioMoodle;do
|
|
|
+ if [ $cont -eq 1 ];then
|
|
|
+ # Dominio Principal (ServerName)
|
|
|
+ serverName=$dominio
|
|
|
+ else
|
|
|
+ # Dominios Secundarios (ServerAlias)
|
|
|
+ aliasMeoodle=$aliasMoodle" "$dominio
|
|
|
+ fi
|
|
|
+ cont=$((cont + 1))
|
|
|
+ done
|
|
|
+ dominioMoodle=$serverName
|
|
|
+ unset dominio cont serverName aliasMoodle
|
|
|
}
|
|
|
|
|
|
establecerFQDN() {
|
|
@@ -850,7 +883,7 @@ instalarVirtualHost() {
|
|
|
ln -s "/etc/$webServerName/sites-available/$virtualHostName" "/etc/$webServerName/sites-enabled/$virtualHostName" >> $logFile 2>&1
|
|
|
comprobarError $? 911 $virtualHostName
|
|
|
recargarServicio $webServerName
|
|
|
- unset rootVirtualHost dominioVirtualHost virtualHostFile virtualHostName aliasVirtualHost
|
|
|
+ unset rootVirtualHost dominioVirtualHost virtualHostFile virtualHostName aliasVirtualHost socket
|
|
|
}
|
|
|
|
|
|
mostrarDatabase() {
|
|
@@ -1374,7 +1407,7 @@ configurarMediaWiki() {
|
|
|
comprobarError $? 502
|
|
|
fi
|
|
|
instalarVirtualHost "/var/www/$dominioMediaWiki" $virtualHost $dominioMediaWiki $aliasMediaWiki
|
|
|
- unset virtualHost socket
|
|
|
+ unset virtualHost
|
|
|
else
|
|
|
comprobarError 1 503 $dominioMediaWiki
|
|
|
fi
|
|
@@ -1396,15 +1429,33 @@ configurarMoodle() {
|
|
|
# Configurar Moodle
|
|
|
if [ ! -f /var/www/$dominioMoodle/config.php ];then
|
|
|
# Copiamos archivos
|
|
|
- cp -fR ./var/moodle/ /var/www/$dominioMoodle
|
|
|
+ cp -Rf ./var/moodle/ /var/www/$dominioMoodle
|
|
|
comprobarError $? 602
|
|
|
# Crear carperta de datos (no online)
|
|
|
+ if [ ! -d /var/www/moodledata ];then
|
|
|
+ mkdir /var/www/moodledata 2>/dev/null
|
|
|
+ comprobarError $? 602
|
|
|
+ fi
|
|
|
# Creamos Base de Datos
|
|
|
nombreDBMo=$(echo $dominioMoodle | sed -e 's/\./_/g')
|
|
|
userDBMo=$(echo $dominioMoodle | sed -e 's/\./_/g')
|
|
|
crearDBMoodle
|
|
|
# Actualizamos permisos
|
|
|
- chown -R $webServerUser:$webServerGroup /var/www/$dominioMoodle
|
|
|
+ chown -R $webServerUser:$webServerGroup /var/www/$dominioMoodle /var/www/moodledata
|
|
|
+ # Configuramos VirtualHost
|
|
|
+ if [ $apacheOn = true ] && [ $sslOn = false ];then
|
|
|
+ virtualHost="./etc/apache2/sites-available/moodle.conf"
|
|
|
+ elif [ $nginxOn = true ] && [ $sslOn = false ];then
|
|
|
+ virtualHost="./etc/nginx/sites-available/moodle.conf"
|
|
|
+ elif [ $apacheOn = true ] && [ $sslOn = true ];then
|
|
|
+ virtualHost="./etc/apache2/sites-available/moodle-ssl.conf"
|
|
|
+ elif [ $nginxOn = true ] && [ $sslOn = true ];then
|
|
|
+ virtualHost="./etc/nginx/sites-available/moodle-ssl.conf"
|
|
|
+ else
|
|
|
+ comprobarError 1 602
|
|
|
+ fi
|
|
|
+ instalarVirtualHost "/var/www/$dominioMoodle" $virtualHost $dominioMoodle
|
|
|
+ unset virtualHost
|
|
|
else
|
|
|
comprobarError 1 603 $dominioMoodle
|
|
|
fi
|
|
@@ -1554,6 +1605,7 @@ mostrarExpress
|
|
|
echo -en " OK.\n" | tee -a $logFile
|
|
|
fi
|
|
|
# Arrancar y habilitar todos los servicios (SystemD, Service o SystemV)
|
|
|
+ echo -en "Habilitando todos los servicios..." | tee -a $logFile
|
|
|
# {
|
|
|
# echo -en "%s\n" $((100 * progreso / progresoTotal))
|
|
|
if [ $apacheOn = true ];then
|
|
@@ -1566,6 +1618,7 @@ mostrarExpress
|
|
|
fi
|
|
|
progreso=$((progreso + 1))
|
|
|
# } > >(whiptail --gauge "Arrancando Servicios..." $((ALTO * 4 / 10)) $((ANCHO * 9 / 10)) $((100 * progreso / progresoTotal)))
|
|
|
+ echo -en " OK.\n" | tee -a $logFile
|
|
|
# MediaWiki
|
|
|
if [ $mediaWikiOn = true ]; then
|
|
|
# Descargar MediaWiki
|
|
@@ -1599,7 +1652,7 @@ mostrarExpress
|
|
|
echo -en "Configurando Moodle..." | tee -a $logFile
|
|
|
# {
|
|
|
# echo -en "%s\n" $((100 * progreso / progresoTotal))
|
|
|
- #configurarMoodle
|
|
|
+ configurarMoodle
|
|
|
progreso=$((progreso + 1))
|
|
|
# } > >(whiptail --gauge "Configurando Moodle..." $((ALTO * 4 / 10)) $((ANCHO * 9 / 10)) $((100 * progreso / progresoTotal)))
|
|
|
echo -en " OK.\n" | tee -a $logFile
|