Setup.sh updated
This commit is contained in:
parent
8b3ea9e89f
commit
ffd681a654
2 changed files with 48 additions and 14 deletions
14
assets/config/nginx/nginx_HTTP.conf
Normal file
14
assets/config/nginx/nginx_HTTP.conf
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
###########################################################
|
||||
### ###
|
||||
### MESHPI NGINX CONFIG ###
|
||||
### ###
|
||||
###########################################################
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name DOMAIN IPADDR;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:5000;
|
||||
}
|
||||
}
|
||||
|
|
@ -13,10 +13,10 @@ echo -e "\n ${LCY}Dependency and Privilege Check running...${CRS}\n"
|
|||
### PRIVILEGES
|
||||
|
||||
if (( $(id -u) == 0 )); then ### AM I ROOT ?
|
||||
echo -e " ${GRN}Privilege check passed...${CRS}\n"
|
||||
echo -e " ${LCY}- ${GRN}Privilege check passed...${CRS}\n"
|
||||
|
||||
else
|
||||
echo -e " ${RED}Privilege check failed... Please run script with sudo or as root!${CRS}\n"
|
||||
echo -e " ${LCY}- ${RED}Privilege check failed... Please run script with sudo or as root!${CRS}\n"
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
|
@ -41,10 +41,10 @@ installed="$(cat /tmp/LoMeS/installed_dev 2>/dev/null)"
|
|||
missing="$(cat /tmp/LoMeS/missing_dev 2>/dev/null)"
|
||||
|
||||
if ! [ "$missing" ]; then
|
||||
echo -e " ${GRN}Dependencies met. Proceeding...${CRS}\n"
|
||||
echo -e " ${LCY}- ${GRN}Dependencies met. Proceeding...${CRS}\n"
|
||||
|
||||
else ### INSTALLING PKGS !
|
||||
echo -e " ${RED}Following dependencies are missing :\n\n$missing${CRS}"
|
||||
echo -e " ${LCY}- ${RED}Following dependencies are missing :\n\n$missing${CRS}"
|
||||
|
||||
while true; do
|
||||
echo -e "\n ${YEL}Do you wish to install via APT?"
|
||||
|
|
@ -52,8 +52,8 @@ else
|
|||
echo -e "${CRS}"
|
||||
|
||||
if [[ "$install_dep" = "" || "$install_dep" = "y" || "$install_dep" = "Y" ]]; then
|
||||
sudo apt update > /dev/null 2>&1 && sudo apt install -y $missing > /dev/null 2>&1
|
||||
echo -e " ${GRN}Dependencies installed. Proceeding...${CRS}\n"
|
||||
sudo apt update > /dev/null 2>&1 && sudo apt install -y $missing --simulate > /dev/null 2>&1
|
||||
echo -e " ${LCY}- ${GRN}Dependencies installed. Proceeding...${CRS}\n"
|
||||
sudo rm /tmp/LoMeS/installed_dev /tmp/LoMeS/missing_dev 2>/dev/null
|
||||
break
|
||||
|
||||
|
|
@ -122,12 +122,12 @@ while true; do
|
|||
fi
|
||||
done
|
||||
|
||||
while true; do ### CERTIFICATION & CONFIGURATION
|
||||
while true; do ### CERTIFICATION & CONFIGURATION HTTPS
|
||||
echo -e "\n ${YEL}Configure nginx with SSL and create a self signed cetrificate?"
|
||||
read -p " (Y/n) --> " installSSL
|
||||
read -p " (Y/n) --> " nginxSSL
|
||||
echo -e "${CRS}"
|
||||
|
||||
if [[ "$installSSL" = "" || "$installSSL" = "y" || "$installSSL" = "Y" ]]; then
|
||||
if [[ "$nginxSSL" = "" || "$nginxSSL" = "y" || "$nginxSSL" = "Y" ]]; then
|
||||
echo -e " ${YEL}Enter path to certificates folder"
|
||||
read -p " default = /etc/nginx/ssl --> " cert_path
|
||||
echo -e "${CRS}"
|
||||
|
|
@ -165,8 +165,28 @@ while true; do
|
|||
sudo sed -i "s|KEYPATH|$cert_path/$cert_name|" /etc/nginx/sites-enabled/$(hostname).conf
|
||||
break
|
||||
|
||||
elif [[ "$installSSL" == "n" || "$installSSL" = "N" ]]; then
|
||||
echo -e "\n ${YEL}Nginx configuration skipped!${CRS}"
|
||||
elif [[ "$nginxSSL" == "n" || "$nginxSSL" = "N" ]]; then
|
||||
while true; do ### CONFIGURATION HTTP
|
||||
echo -e " ${YEL}Configure nginx with HTTP?"
|
||||
read -p " (Y/n) --> " nginxHTTP
|
||||
echo -e "${CRS}"
|
||||
|
||||
if [[ "$nginxHTTP" = "" || "$nginxHTTP" = "y" || "$nginxHTTP" = "Y" ]]; then
|
||||
sudo cp assets/config/nginx/nginx_HTTP.conf /etc/nginx/sites-enabled/$(hostname).conf
|
||||
sudo sed -i "s/DOMAIN/$(hostname).local/g" /etc/nginx/sites-enabled/$(hostname).conf
|
||||
sudo sed -i "s/IPADDR/$ip4/g" /etc/nginx/sites-enabled/$(hostname).conf
|
||||
break
|
||||
|
||||
elif [[ "$nginxHTTP" = "n" || "$nginxHTTP" = "N" ]]; then
|
||||
echo -e " ${LCY}- ${LRD}Keeping nginx default configuration!${CRS}"
|
||||
break
|
||||
|
||||
else
|
||||
echo -e " ${YEL}Invalid response... Try again...\n\n Y = (Yes, configure nginx)\n N = (No, skip nginx configuration)${CRS}\n "
|
||||
break
|
||||
|
||||
fi
|
||||
done
|
||||
break
|
||||
|
||||
else
|
||||
|
|
@ -180,7 +200,7 @@ done
|
|||
sudo rm -rf /var/www/html
|
||||
|
||||
if ! [ "$(sudo nginx -t > /dev/null 2>&1)" ]; then ### NGINX CONF CHECK
|
||||
echo -e "\n ${LGN}Nginx configuration checks out...${CRS}"
|
||||
echo -e "\n ${LCY}- ${LGN}Nginx configuration checks out...${CRS}"
|
||||
|
||||
else
|
||||
echo -e "\n ${LRD}Nginx configuration is malformed!${CRS}"
|
||||
|
|
@ -188,7 +208,7 @@ else
|
|||
fi
|
||||
|
||||
if ! [ "$(sudo nginx -s reload > /dev/null 2>&1)" ]; then ### RELOAD NGINX
|
||||
echo -e "\n ${LGN}Nginx reloaded...${CRS}"
|
||||
echo -e "\n ${LCY}- ${LGN}Nginx reloaded...${CRS}"
|
||||
|
||||
else
|
||||
echo -e "\n ${LRD}Nginx couldn't reload!${CRS}"
|
||||
|
|
@ -196,7 +216,7 @@ else
|
|||
fi
|
||||
|
||||
if ! [ -f "/tmp/LoMeS/install_log" ]; then ### LOG CHECK
|
||||
echo -e "\n ${LGN}No errors while setting up...${CRS}\n"
|
||||
echo -e "\n ${LCY}- ${LGN}No errors while setting up...${CRS}"
|
||||
|
||||
else
|
||||
echo -e "\n ${LRD}Error occured during setup! Please check ${LCY}/tmp/LoMeS/install_log ${LRD}for details...${CRS}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue