diff --git a/README.md b/README.md index 4119dd0..5ee0cdc 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ sudo apt install -y git ``` 3. Clone repository ```bash -git clone https://lab.c95.org/fr4nz/LoMeS.git && cd LoMeS && git switch dev-1 +git clone https://lab.c95.org/fr4nz/LoMeS.git && cd LoMeS && git switch dev-stable ``` 4. Run development environment setup ```bash diff --git a/lomes-app.py b/lomes-app.py index 499e3ae..2a116cc 100755 --- a/lomes-app.py +++ b/lomes-app.py @@ -2,6 +2,7 @@ from flask import Flask, render_template import getpass +import socket app = Flask(__name__) @@ -10,5 +11,4 @@ def index(): user=getpass.getuser() return render_template("index.html", user=user) - app.run(host="127.0.0.1", port=5000) diff --git a/lomes-setup.sh b/lomes-setup.sh index 25de607..3f4ec5f 100755 --- a/lomes-setup.sh +++ b/lomes-setup.sh @@ -1,6 +1,7 @@ #!/bin/bash trap "exit" INT +chmod +x lomes-app.py mkdir -p /tmp/LoMeS source assets/shell/colors source assets/config/deps/dependencies @@ -70,11 +71,11 @@ fi ### NGINX SETUP & CONFIG -###### HOST +###### CONNECTION & INTERFACE -onif=$(/sbin/ip route get 162.249.72.1 | awk '{print $5}' | cut -d/ -f1) ### GET ACTIVE NETWORK INTERFACE ! +onif=$(/sbin/ip route get 162.249.72.1 | awk '{print $5}' | cut -d/ -f1) -while true; do +while true; do ### SELECT NETWORK INTERFACE ! echo -e " ${YEL}What network interface will nginx be using?" read -p " current = "$onif" --> " nif echo -e "${CRS}" @@ -97,8 +98,8 @@ echo -e "\n ${YEL}Current hostname : ${LCY}$(hostname)${CRS}" echo -e " ${YEL}Current ip address : ${LCY}$ip4 ${YEL}@ ${LCY}$nif${CRS}" echo -e "\n ${YEL}This information will be used to configure ${LCY}nginx.conf ${YEL}during the next steps." -while true; do - read -p " Would you like to change the hostname? (y/N) --> " conf_hostname ### HOST NAME CHANGE ? +while true; do ### HOST NAME CHANGE ? + read -p " Would you like to change the hostname? (y/N) --> " conf_hostname echo -e "${CRS}" if [[ "$conf_hostname" = "" || "$conf_hostname" = "n" || "$conf_hostname" = "N" ]]; then @@ -121,10 +122,8 @@ while true; do fi done -###### CERTIFICATION & CONFIGURATION - -while true; do - echo -e "\n ${YEL}Configure SSL and create a self signed cetrificate?" +while true; do ### CERTIFICATION & CONFIGURATION + echo -e "\n ${YEL}Configure nginx with SSL and create a self signed cetrificate?" read -p " (Y/n) --> " installSSL echo -e "${CRS}" @@ -167,7 +166,7 @@ while true; do break elif [[ "$installSSL" == "n" || "$installSSL" = "N" ]]; then - echo -e "\n ${RED}Encryption disabled${CRS}\n" + echo -e "\n ${YEL}Nginx configuration skipped!${CRS}\n" break else @@ -176,7 +175,7 @@ while true; do fi done -###### NGINX MAINTENANCE & LANDING PAGE +###### NGINX MAINTENANCE sudo rm -rf /var/www/html @@ -212,10 +211,13 @@ if [ -f "/tmp/LoMeS/honacha" ]; then echo -e "${CRS}" if [[ "$reboot" = "" || "$reboot" = "y" || "$reboot" = "Y" ]]; then + echo -e " ${YEL}Rebooting in 10sec..." + echo -e " ${YEL}to start flask manually, run ${LCY}python3 lomes-app.py ${YEL}from LoMeS directory${CRS}" + sleep 10s sudo reboot - break elif [[ "$reboot" = "n" || "$reboot" = "N" ]]; then + echo -e " ${YEL}to start flask manually, run ${LCY}python3 lomes-app.py ${YEL}from LoMeS directory${CRS}" break else @@ -225,8 +227,26 @@ if [ -f "/tmp/LoMeS/honacha" ]; then done else - chmod +x lomes-app.py - ./lomes-app.py &> /dev/null & disown - echo -e " ${LGN}Flask is running...${CRS}\n" + + while true; do ### START FLASK ? + read -p " Would you like to start flask? (Y/n) --> " flask_start + echo -e "${CRS}" + + if [[ "$flask_start" = "" || "$flask_start" = "y" || "$flask_start" = "Y" ]]; then + echo -e " ${YEL}Starting flask in 10sec..." + echo -e " ${YEL}to start flask manually, run ${LCY}python3 lomes-app.py ${YEL}from LoMeS directory${CRS}" + sleep 10s + python3 lomes-app.py + break + + elif [[ "$flask_start" = "n" || "$flask_start" = "N" ]]; then + echo -e " ${YEL}to start flask manually, run ${LCY}python3 lomes-app.py ${YEL}from LoMeS directory${CRS}" + break + + else + echo -e "\n ${YEL}Invalid response... Try again...\n\n Y = (Yes, to start flask)\n N = (No, start flask later)${CRS}\n " + + fi + done fi \ No newline at end of file diff --git a/static/style.css b/static/style.css index 7ae2e0e..b9478d2 100644 --- a/static/style.css +++ b/static/style.css @@ -135,4 +135,12 @@ p { padding-bottom: 10px; text-align: center; color: lightgray; +} + +li { + font-size: 16px; + padding: 5px; + padding-bottom: 10px; + text-align: center; + color: lightgray; } \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 678dabe..541c51f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -15,15 +15,16 @@
Hi {{user}}
If you see this site, means "LoMeS" development environment is running!
Thanks for collaborating and trying to make things more real...