webinoly/weby
Cristhian Martínez Ochoa 2b81c7c4be php-ver improved error messages
Now we detect when same version is already installed and give a proper message, not generic error.
2018-02-25 16:51:57 -07:00

111 lines
2.7 KiB
Bash

#!/bin/bash
# Webinoly script.
# This script is designed to install latest Webinoly.
webyversion="1.3.1-beta"
# Check OS support
distr=`echo $(lsb_release -i | cut -d':' -f 2)`
osver=`echo $(lsb_release -c | cut -d':' -f 2)`
if ! [[ $distr == "Ubuntu" && $osver =~ ^(xenial)$ ]]; then
echo "$(tput setaf 1)"
echo "****************************************************************************"
echo "**** This OS is not supported by Webinoly and could not work properly ****"
echo "****************************************************************************"
echo "$(tput sgr0)"
read -p "Press [Enter] key to continue..."
fi
if [[ -n "$1" ]]; then
setup="$1"
else
setup=9
fi
# Diplay menu to select type of server
while ! [[ ($setup -ge 0 && $setup -le 4 && $setup =~ ^[0-9]+$) || $setup == '-vbeta' ]] 2>/dev/null
do
echo ""
echo " 1 - HTML Server"
echo " 2 - PHP Server"
echo " 3 - LEMP Server (Default)"
echo " 4 - Custom Configuration"
echo " 0 - Maybe later..."
echo ""
read -p "Select the desired option to configure your server: " setup
echo ""
echo "------------------------------------------------"
setup=${setup:-3}
done
if [[ ! -d /opt/webinoly ]]; then
sudo mkdir /opt/webinoly
fi
# Download and install Webinoly
if [[ $setup == '-vbeta' ]]; then
echo ""
sudo wget --timeout=15 -qrO $HOME/webinoly.tar https://qrok.es/wytarb
echo "$(tput setaf 1)"
echo "[WARNING] You are installing a BETA version of Webinoly and it's not recommended for production enviroments. $(tput sgr0)"
else
sudo wget --timeout=15 -qrO $HOME/webinoly.tar https://qrok.es/wytar
fi
sudo tar -xf $HOME/webinoly.tar -C /opt/webinoly
sudo find /opt/webinoly -type d -exec chmod 755 {} \;
sudo find /opt/webinoly -type f -exec chmod 644 {} \;
# Install plugins
sudo chmod 755 /opt/webinoly/plugins/*
sudo mv /opt/webinoly/plugins/* /usr/bin/
source /opt/webinoly/lib/install
# Check for uninstalled Webinoly conf file
if [[ -a $HOME/.webinoly-conf-restore_dont-remove ]]; then
sudo mv $HOME/.webinoly-conf-restore_dont-remove /opt/webinoly/webinoly.conf
fi
# Save Tools Port after library is available.
if [[ -a /opt/webinoly/webinoly.conf && -n $(conf_read tools-port) ]]; then
echo "${gre}Webinoly Configuration file was found, so we will use it!${end}"
else
portools="22222"
if [[ -n "$2" ]]; then
portools="$2"
fi
tools_port $portools
fi
# Write app version
conf_write app-version $webyversion
# NGINX Installation
if [[ $setup -gt 0 && $setup != 4 ]]; then
stack -nginx
fi
# PHP Installation
if [[ $setup -gt 1 && $setup != 4 ]]; then
stack -php
fi
# MySQL & PhpMyAdmin Installation
if [[ $setup -gt 2 && $setup != 4 ]]; then
stack -mysql
fi
# Custom Config
if [ $setup == 4 ]; then
config_load
fi
# Remove Installation File
sudo rm weby
app_purge