Explorar el Código

* Añadido configurarApache()
* Añadido ficheros de configuración
* Al copiar ficheros añadir -f (force)

Guzmán Castanedo Villalba hace 6 años
padre
commit
1ced7dcd6f
Se han modificado 1 ficheros con 27 adiciones y 7 borrados
  1. 27 7
      install

+ 27 - 7
install

@@ -36,10 +36,10 @@ comprobarError() {
 			error="$type $codeNum:\tError interno (selección avanzada).\n"
 			;;
 		4)
-			error="\n$type $codeNum:\tEl archivo '$extraInfo' no existe.\n"
+			error="\n$type $codeNum:\tEl archivo '"$(realpath $extraInfo)"' no existe.\n"
 			;;
 		5)
-			error="\n$type $codeNum:\tEl directorio '$extraInfo' no existe.\n"
+			error="\n$type $codeNum:\tEl directorio '"$(realpath $extraInfo)"' no existe.\n"
 			;;
 		100)
 			error="$type $codeNum:\tError interno (selección del servidor web).\n"
@@ -66,6 +66,9 @@ comprobarError() {
 		107)
 			error="\n$type $codeNum:\tError al configurar Nginx.\n"
 			;;
+		108)
+			error="\n$type $codeNum:\tError al configurar Apache2.\n"
+			;;
 		200)
 			error="$type $codeNum:\tError interno (selección de base de datos).\n"
 			;;
@@ -459,6 +462,23 @@ instalarApache() {
 	fi
 }
 
+configurarApache() {
+	if [ $rhelOS = true ];then
+		apacheConfFile="./etc/apache-rhel/conf/httpd.conf"
+		welcomeConfFile="/etc/httpd/conf.d/welcome.conf"
+		if [ ! -f $apacheConfFile ];then
+			comprobarError 1 4 $apacheConfFile
+		fi
+		cp -f $apacheConfFile /etc/httpd/conf/ 2>/dev/null
+		comprobarError $? 108
+		if [ -f $welcomeConfFile ];then
+			sed -i -e 's/^/#/' $welcomeConfFile
+			comprobarError $? 108
+		fi
+		unset apacheConfFile welcomeConfFile
+	fi
+}
+
 instalarNginx() {
 	if [ $debianOS = true ];then
 		result=$(apt-get -q -y install nginx 2>&1)
@@ -484,7 +504,7 @@ configurarNginx() {
 		nginxConfFile="./etc/nginx-rhel"
 	fi
 	if [ -d "$nginxConfFile" ];then
-		cp -R $nginxConfFile/* /etc/nginx/ 2>/dev/null
+		cp -Rf $nginxConfFile/* /etc/nginx/ 2>/dev/null
 		comprobarError $? 107
 	else
 		comprobarError 1 5 "$nginxConfFile"
@@ -663,7 +683,7 @@ configurarPHP() {
 		comprobarError 1 4 "$phpConfFile"
 	fi
 	# Copiamos configuración
-	cp $phpConfFile $phpDest 2>/dev/null
+	cp -f $phpConfFile $phpDest 2>/dev/null
 	comprobarError $? 305
 	# Configuramos cgi.fix_pathinfo
 	sed -i '/cgi.fix_pathinfo=/c\cgi.fix_pathinfo=0' $phpDest
@@ -681,7 +701,7 @@ configurarPHP() {
 		if [ ! -f $phpConfFile ];then
 			comprobarError $? 4 "$phpConfFile"
 		fi
-		cp $phpConfFile $phpDest 2>/dev/null
+		cp -f $phpConfFile $phpDest 2>/dev/null
 		comprobarError $? 305
 	fi
 	unset phpConfFile phpDest
@@ -708,7 +728,7 @@ instalarPHPInfo() {
 	if [ ! -f $infoFile ];then
 		comprobarError 1 4 "$infoFile"
 	fi
-	cp $infoFile /var/www/html/ 2>/dev/null
+	cp -f $infoFile /var/www/html/ 2>/dev/null
 	comprobarError $? 106
 	unset infoFile
 }
@@ -926,7 +946,7 @@ mostrarExpress
 		echo -en "Configurando Servidor Web Apache..." | tee -a $logFile
 #		{
 #			echo -en "%s\n" $((100 * progreso / progresoTotal))
-			sleep 2
+			configurarApache
 			progreso=$((progreso + 1))
 #		} > >(whiptail --gauge "Configurando Servidor Web..." $((ALTO * 4 / 10)) $((ANCHO * 9 / 10)) $((100 * progreso / progresoTotal)))
 		echo -en " OK.\n" | tee -a $logFile