setup script updated

This commit is contained in:
Fr4nz D13trich 2025-10-12 17:46:01 +02:00
parent c071de983f
commit 9824d03655

View file

@ -11,7 +11,7 @@ echo -e "\n ${LCY}Dependency and Privilege Check running...${CRS}\n"
### PRIVILEGES ### PRIVILEGES
if (( $(id -u) == 0 )); then ### AM I ROOT ? if (( $(id -u) == 0 )); then ### AM I ROOT ?
echo -e " ${GRN}Privilege check passed...${CRS}\n" echo -e " ${GRN}Privilege check passed...${CRS}"
else else
echo -e " ${RED}Privilege check failed... Please run script with sudo or as root!${CRS}\n" echo -e " ${RED}Privilege check failed... Please run script with sudo or as root!${CRS}\n"
@ -39,10 +39,10 @@ installed="$(cat /tmp/LoMeS/installed_dev 2>/dev/null)"
missing="$(cat /tmp/LoMeS/missing_dev 2>/dev/null)" missing="$(cat /tmp/LoMeS/missing_dev 2>/dev/null)"
if ! [ "$missing" ]; then if ! [ "$missing" ]; then
echo -e "\n ${GRN}Dependencies met. Proceeding...${CRS}\n" echo -e " ${GRN}Dependencies met. Proceeding...${CRS}\n"
else ### INSTALLING PKGS ! else ### INSTALLING PKGS !
echo -e "\n ${RED}Following dependencies are missing :\n\n$missing${CRS}" echo -e " ${RED}Following dependencies are missing :\n\n$missing${CRS}"
while true; do while true; do
echo -e "\n ${YEL}Do you wish to install via APT?" echo -e "\n ${YEL}Do you wish to install via APT?"
@ -51,17 +51,17 @@ else
if [[ "$install_dep" = "" || "$install_dep" = "y" || "$install_dep" = "Y" ]]; then 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 sudo apt update > /dev/null 2>&1 && sudo apt install -y $missing > /dev/null 2>&1
echo -e "\n ${GRN}Dependencies installed. Proceeding...${CRS}\n" echo -e " ${GRN}Dependencies installed. Proceeding...${CRS}\n"
sudo rm /tmp/LoMeS/installed_dev /tmp/LoMeS/missing_dev 2>/dev/null sudo rm /tmp/LoMeS/installed_dev /tmp/LoMeS/missing_dev 2>/dev/null
break break
elif [[ "$install_dep" == "n" || "$install_dep" = "N" ]]; then elif [[ "$install_dep" == "n" || "$install_dep" = "N" ]]; then
echo -e "\n ${RED}Missing dependencies... Exiting!${CRS}\n" echo -e " ${RED}Missing dependencies... Exiting!${CRS}\n"
sudo rm /tmp/LoMeS/installed_dev /tmp/LoMeS/missing_dev 2>/dev/null sudo rm /tmp/LoMeS/installed_dev /tmp/LoMeS/missing_dev 2>/dev/null
exit 1 exit 1
else else
echo -e "\n ${YEL}Invalid response... Try again...\n\n ${GRN}Y ${YEL}= (Yes, install dependencies and continue)\n ${RED}N ${YEL}= (No, don't install dependencies and exit)${CRS}\n " echo -e " ${YEL}Invalid response... Try again...\n\n ${GRN}Y ${YEL}= (Yes, install dependencies and continue)\n ${RED}N ${YEL}= (No, don't install dependencies and exit)${CRS}\n "
fi fi
done done
@ -74,8 +74,9 @@ fi
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) ### GET ACTIVE NETWORK INTERFACE !
while true; do while true; do
echo -e " ${YEL}What network interface will nginx be using?${CRS}" echo -e " ${YEL}What network interface will nginx be using?"
read -p " current = "$onif" --> " nif read -p " current = "$onif" --> " nif
echo -e "${CRS}"
if ! [ "$nif" ]; then if ! [ "$nif" ]; then
nif="$onif" nif="$onif"
@ -93,10 +94,11 @@ done
ip4=$(/sbin/ip -o -4 addr list "$nif" | awk '{print $4}' | cut -d/ -f1) ### GET IP FOR CHOSEN INTERFACE ! ip4=$(/sbin/ip -o -4 addr list "$nif" | awk '{print $4}' | cut -d/ -f1) ### GET IP FOR CHOSEN INTERFACE !
echo -e "\n ${YEL}Current hostname : ${LCY}$(hostname)${CRS}" echo -e "\n ${YEL}Current hostname : ${LCY}$(hostname)${CRS}"
echo -e " ${YEL}Current ip address : ${LCY}$ip4 ${YEL}@ ${LCY}$nif${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.${CRS}" echo -e "\n ${YEL}This information will be used to configure ${LCY}nginx.conf ${YEL}during the next steps."
while true; do while true; do
read -p " Would you like to change the hostname? (y/N) --> " conf_hostname ### HOST NAME CHANGE ? read -p " Would you like to change the hostname? (y/N) --> " conf_hostname ### HOST NAME CHANGE ?
echo -e "${CRS}"
if [[ "$conf_hostname" = "" || "$conf_hostname" = "n" || "$conf_hostname" = "N" ]]; then if [[ "$conf_hostname" = "" || "$conf_hostname" = "n" || "$conf_hostname" = "N" ]]; then
new_hostname=$(hostname) new_hostname=$(hostname)
@ -126,8 +128,9 @@ while true; do
echo -e "${CRS}" echo -e "${CRS}"
if [[ "$installSSL" = "" || "$installSSL" = "y" || "$installSSL" = "Y" ]]; then if [[ "$installSSL" = "" || "$installSSL" = "y" || "$installSSL" = "Y" ]]; then
echo -e " ${YEL}Enter path to certificates folder${CRS}" echo -e " ${YEL}Enter path to certificates folder"
read -p " default = /etc/nginx/ssl --> " cert_path read -p " default = /etc/nginx/ssl --> " cert_path
echo -e "${CRS}"
if ! [ "$cert_path" ]; then if ! [ "$cert_path" ]; then
cert_path=/etc/nginx/ssl cert_path=/etc/nginx/ssl
@ -150,7 +153,6 @@ while true; do
: :
fi fi
echo ""
sudo mkdir -p "$cert_path" sudo mkdir -p "$cert_path"
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout "$cert_path"/"$cert_name".key -out "$cert_path"/"$cert_name".crt sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout "$cert_path"/"$cert_name".key -out "$cert_path"/"$cert_name".crt
echo -e "\n ${GRN}SSL certificate files ${LCY}$cert_name.crt ${GRN}and ${LCY}$cert_name.key ${GRN}created and stored in ${LCY}$cert_path${CRS}\n" echo -e "\n ${GRN}SSL certificate files ${LCY}$cert_name.crt ${GRN}and ${LCY}$cert_name.key ${GRN}created and stored in ${LCY}$cert_path${CRS}\n"