|
@@ -81,6 +81,15 @@ comprobarDependencias() {
|
|
|
printf "ERROR:\t'apt-get' no está disponible.\n"
|
|
|
exit 1
|
|
|
fi
|
|
|
+ #Actualizamos base de datos del repositorio
|
|
|
+ printf "Actualizando repositorio APT..."
|
|
|
+ result=$(apt-get -q -y update)
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
+ printf "\nERROR:\tImposible actualizar repositorio.\n"
|
|
|
+ printf "Detalles:\n$result\n"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+ printf " OK.\n"
|
|
|
fi
|
|
|
if [ $rhelOS = true ]; then
|
|
|
which yum > /dev/null 2>&1
|
|
@@ -88,6 +97,14 @@ comprobarDependencias() {
|
|
|
printf "ERROR:\t'yum' no está disponible.\n"
|
|
|
exit 1
|
|
|
fi
|
|
|
+ printf "Actualizando repositorio YUM..."
|
|
|
+ result=$(yum -y makecache 2>&1)
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
+ printf "\nERROR:\tImposible actualizar repositorio.\n"
|
|
|
+ printf "Detalles:\n$result\n"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+ printf " OK.\n"
|
|
|
fi
|
|
|
}
|
|
|
|
|
@@ -103,6 +120,115 @@ mostrarBienvenida() {
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
+mostrarComponentes() {
|
|
|
+ componentes=$(whiptail --title "Instalación" --checklist "<ESPACIO>: seleccionar <TAB>: cambiar <FLECHAS>: moverse\n\nEscoge los componentes que quieres instalar:" 20 70 5 \
|
|
|
+ "WebServer" "Instalar servidor web http/https" ON \
|
|
|
+ "Database" "Instalar una base de datos SQL" ON \
|
|
|
+ "PHP" "Instala PHP7" ON \
|
|
|
+ "SSL/TLS" "Instala certificados para activar HTTPS" ON \
|
|
|
+ "MediaWiki" "Instala la última versión de MediaWiki" ON \
|
|
|
+ --ok-button "Continuar" --cancel-button "Salir" 3>&1 1>&2 2>&3)
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
+ printf "ERROR:\tInstalación interrumpida por el usuario.\n"
|
|
|
+ exit 2
|
|
|
+ fi
|
|
|
+ # Mejora: autodetección de componentes ya instalados
|
|
|
+ for i in $componentes; do
|
|
|
+ case $i in
|
|
|
+ \"WebServer\")
|
|
|
+ printf "Instalando Servidor Web"
|
|
|
+ instalarWebServer
|
|
|
+ printf " OK.\n"
|
|
|
+ ;;
|
|
|
+ \"Database\")
|
|
|
+ printf "Instalando Servidor Database..."
|
|
|
+ printf " OK.\n"
|
|
|
+ ;;
|
|
|
+ \"PHP\")
|
|
|
+ printf "Instalando PHP..."
|
|
|
+ printf " OK.\n"
|
|
|
+ ;;
|
|
|
+ \"SSL/TLS\")
|
|
|
+ printf "Instalando SSL/TLS..."
|
|
|
+ printf " OK.\n"
|
|
|
+ ;;
|
|
|
+ \"MediaWiki\")
|
|
|
+ printf "Instalando MediaWiki..."
|
|
|
+ printf " OK.\n"
|
|
|
+ ;;
|
|
|
+ *)
|
|
|
+ printf "ERROR:\tError interno (selección de componentes).\n"
|
|
|
+ exit 1
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+ done
|
|
|
+}
|
|
|
+
|
|
|
+instalarWebServer() {
|
|
|
+ webServer=$(whiptail --title "Servidor Web" --radiolist "" 20 70 2 \
|
|
|
+ "Apache" "Instalar el servidor web Apache2" ON \
|
|
|
+ "Nginx" "Instalar el servidor web Nginx" OFF \
|
|
|
+ --ok-button "Continuar" --cancel-button "Salir" 3>&1 1>&2 2>&3)
|
|
|
+ # Preguntar otras opciones de configuración
|
|
|
+ case $webServer in
|
|
|
+ Apache)
|
|
|
+ printf " Apache..."
|
|
|
+ instalarApache
|
|
|
+ ;;
|
|
|
+ Nginx)
|
|
|
+ printf " Nginx..."
|
|
|
+ instalarNginx
|
|
|
+ ;;
|
|
|
+ *)
|
|
|
+ printf "\nERROR:\tError interno (selección de web server).\n"
|
|
|
+ exit 1
|
|
|
+ ;;
|
|
|
+ esac
|
|
|
+}
|
|
|
+
|
|
|
+instalarApache() {
|
|
|
+ if [ $debianOS = true ];then
|
|
|
+ result=$(apt-get -q -y install apache2 2>&1)
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
+ printf "\nERROR:\tError al instalar apache2.\n"
|
|
|
+ printf "Detalles:\n$result\n"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+ elif [ $rhelOS = true ]; then
|
|
|
+ result=$(yum -y install httpd 2>&1)
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
+ printf "\nERROR:\tError al instalar apache2.\n"
|
|
|
+ printf "Detalles:\n$result\n"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+ else
|
|
|
+ printf "\nERROR:\tError interno (instalación apache).\n"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+}
|
|
|
+
|
|
|
+instalarNginx() {
|
|
|
+ if [ $debianOS = true ];then
|
|
|
+ result=$(apt-get -q -y install nginx 2>&1)
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
+ printf "\nERROR:\tError al instalar apache2.\n"
|
|
|
+ printf "Detalles:\n$result\n"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+ elif [ $rhelOS = true ]; then
|
|
|
+ # Hay que instalar primero otro repositorio
|
|
|
+ result=$(yum -y install nginx 2>&1)
|
|
|
+ if [ $? -ne 0 ]; then
|
|
|
+ printf "\nERROR:\tError al instalar apache2.\n"
|
|
|
+ printf "Detalles:\n$result\n"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+ else
|
|
|
+ printf "\nERROR:\tError interno (instalación apache).\n"
|
|
|
+ exit 1
|
|
|
+ fi
|
|
|
+}
|
|
|
+
|
|
|
# Comprobamos
|
|
|
comprobarRoot
|
|
|
OSInfo
|
|
@@ -110,48 +236,21 @@ comprobarDependencias
|
|
|
|
|
|
# Bienvenida
|
|
|
mostrarBienvenida
|
|
|
+# Mejora: instalación express vs instalación avanzada
|
|
|
# Selección de componentes
|
|
|
-componentes=$(whiptail --title "Instalación" --checklist "<ESPACIO>: seleccionar <TAB>: cambiar <FLECHAS>: moverse\n\nEscoge los componentes que quieres instalar:" 20 70 5 \
|
|
|
-"WebServer" "Instalar servidor web http/https" ON \
|
|
|
-"Database" "Instalar una base de datos SQL" ON \
|
|
|
-"PHP" "Instala PHP7" ON \
|
|
|
-"SSL/TLS" "Instala certificados para activar HTTPS" ON \
|
|
|
-"MediaWiki" "Instala la última versión de MediaWiki" ON \
|
|
|
---ok-button "Continuar" --cancel-button "Salir" 3>&1 1>&2 2>&3)
|
|
|
-if [ $? -ne 0 ]; then
|
|
|
- printf "ERROR:\tInstalación interrumpida por el usuario.\n"
|
|
|
- exit 2
|
|
|
-fi
|
|
|
-#printf "$componentes\n"
|
|
|
-for i in $componentes; do
|
|
|
- case $i in
|
|
|
- \"WebServer\")
|
|
|
- printf "Instalación WebServer\n"
|
|
|
- ;;
|
|
|
- \"Database\")
|
|
|
- printf "Instalación Database\n"
|
|
|
- ;;
|
|
|
- \"PHP\")
|
|
|
- printf "Instalación PHP\n"
|
|
|
- ;;
|
|
|
- \"SSL/TLS\")
|
|
|
- printf "Instalación SSL/TLS\n"
|
|
|
- ;;
|
|
|
- \"MediaWiki\")
|
|
|
- printf "Instalación MediaWiki\n"
|
|
|
- ;;
|
|
|
- *)
|
|
|
- printf "ERROR:\tError interno (selección de componentes).\n"
|
|
|
- exit 1
|
|
|
- ;;
|
|
|
- esac
|
|
|
-done
|
|
|
+mostrarComponentes
|
|
|
|
|
|
# Autodestrucción
|
|
|
{
|
|
|
- for i in $(seq 0 5 100); do
|
|
|
+ for i in $(seq 0 5 50); do
|
|
|
sleep 0.1
|
|
|
echo $i
|
|
|
done
|
|
|
} | whiptail --gauge "Autodestrucción..." 7 70 0
|
|
|
+{
|
|
|
+ for i in $(seq 50 5 100); do
|
|
|
+ sleep 0.1
|
|
|
+ echo $i
|
|
|
+ done
|
|
|
+} | whiptail --gauge "Autopulverización..." 7 70 50
|
|
|
|