setup script updated
This commit is contained in:
parent
c071de983f
commit
9824d03655
1 changed files with 12 additions and 10 deletions
|
|
@ -11,7 +11,7 @@ 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 " ${GRN}Privilege check passed...${CRS}"
|
||||
|
||||
else
|
||||
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)"
|
||||
|
||||
if ! [ "$missing" ]; then
|
||||
echo -e "\n ${GRN}Dependencies met. Proceeding...${CRS}\n"
|
||||
echo -e " ${GRN}Dependencies met. Proceeding...${CRS}\n"
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
break
|
||||
|
||||
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
|
||||
exit 1
|
||||
|
||||
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
|
||||
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 !
|
||||
|
||||
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
|
||||
echo -e "${CRS}"
|
||||
|
||||
if ! [ "$nif" ]; then
|
||||
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 !
|
||||
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.${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 ?
|
||||
echo -e "${CRS}"
|
||||
|
||||
if [[ "$conf_hostname" = "" || "$conf_hostname" = "n" || "$conf_hostname" = "N" ]]; then
|
||||
new_hostname=$(hostname)
|
||||
|
|
@ -126,8 +128,9 @@ while true; do
|
|||
echo -e "${CRS}"
|
||||
|
||||
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
|
||||
echo -e "${CRS}"
|
||||
|
||||
if ! [ "$cert_path" ]; then
|
||||
cert_path=/etc/nginx/ssl
|
||||
|
|
@ -150,7 +153,6 @@ while true; do
|
|||
:
|
||||
|
||||
fi
|
||||
echo ""
|
||||
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
|
||||
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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue