Explorar el Código

* Comprobación sobre si info.php se encuentra instalado con anterioridad.

Guzmán Castanedo Villalba hace 6 años
padre
commit
ec5ad839f7
Se han modificado 1 ficheros con 26 adiciones y 17 borrados
  1. 26 17
      install

+ 26 - 17
install

@@ -808,23 +808,28 @@ establecerMaxUpload() {
 
 instalarPHPInfo() {
 	# Instalar fichero php
-	infoFile="./var/www/info.php"
-	if [ ! -f $infoFile ];then
-		comprobarError 1 4 "$infoFile"
-	fi
-	cp -f $infoFile /var/www/html/ 2>/dev/null
-	comprobarError $? 106
-	chown -R $webServerUser:$webServerGroup /var/www/html 2>/dev/null
-	comprobarError $? 106
-	unset infoFile
-	# Instalar VirtualHost
-	if [ $debianOS = true ];then
-		virtualHost="./etc/$webServerName-debian/sites-available/phpinfo.conf"
-	elif [ $rhelOS = true ];then
-		virtualHost="./etc/$webServerName-rhel/sites-available/phpinfo.conf"
+	if [ ! -f /etc/$webServerName/sites-enabled/phpinfo.conf ];then
+		infoFile="./var/www/info.php"
+		if [ ! -f $infoFile ];then
+			comprobarError 1 4 "$infoFile"
+		fi
+		cp -f $infoFile /var/www/html/ 2>/dev/null
+		comprobarError $? 106
+		chown -R $webServerUser:$webServerGroup /var/www/html 2>/dev/null
+		comprobarError $? 106
+		unset infoFile
+		# Instalar VirtualHost
+		if [ $debianOS = true ];then
+			virtualHost="./etc/$webServerName-debian/sites-available/phpinfo.conf"
+		elif [ $rhelOS = true ];then
+			virtualHost="./etc/$webServerName-rhel/sites-available/phpinfo.conf"
+		fi
+		instalarVirtualHost $virtualHost
+		unset virtualHost
+		return 0
+	else
+		return 1
 	fi
-	instalarVirtualHost $virtualHost
-	unset virtualHost
 }
 
 habilitarServicio() {
@@ -1172,7 +1177,11 @@ mostrarExpress
 	if [ $infoPHPOn = true ];then
 		echo -en "Configurando 'info.php'..." | tee -a $logFile
 		instalarPHPInfo
-		echo -en " OK.\n" | tee -a $logFile
+		if [ $? -eq 0 ];then
+			echo -en " OK.\n" | tee -a $logFile
+		else
+			echo -en " Ya se encuentra instalado.\n" | tee -a $logFile
+		fi
 	fi
 # Añadir reglas del cortafuegos
 	echo -en "Configurando Cortafuegos..." | tee -a $logFile