Script updated
This commit is contained in:
parent
0d61d3ea32
commit
5617fe206d
1 changed files with 21 additions and 17 deletions
|
|
@ -11,24 +11,24 @@ CRS="\e[0m"
|
||||||
|
|
||||||
pkgs="openssl nginx"
|
pkgs="openssl nginx"
|
||||||
|
|
||||||
echo -e "\n${CYN}Dependency and Privilege Check running...${CRS}\n"
|
echo -e "\n${CYN} Dependency and Privilege Check running...${CRS}\n"
|
||||||
|
|
||||||
if (( $(id -u) == 0 )); then
|
if (( $(id -u) == 0 )); then
|
||||||
echo -e "${GRN}Privilege check passed...${CRS}\n"
|
echo -e "${GRN} Privilege check passed...${CRS}\n"
|
||||||
|
|
||||||
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"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v "$pkgs" >/dev/null 2>&1; then
|
if command -v "$pkgs" >/dev/null 2>&1; then
|
||||||
echo -e "${GRN}Dependency check passed...${CRS}\n"
|
echo -e "${GRN} Dependency check passed...${CRS}\n"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "${YEL}Dependencies not met.${CRS}\n"
|
echo -e "${YEL} Dependencies not met.${CRS}\n"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Do you wish to install via APT? (Y/n) : " install
|
read -p " Do you wish to install via APT? (Y/n) : " install
|
||||||
|
|
||||||
if [[ "$install" = "" || "$install" = "y" || "$install" = "Y" ]]; then
|
if [[ "$install" = "" || "$install" = "y" || "$install" = "Y" ]]; then
|
||||||
sudo apt update && sudo apt install --install-suggests -y $pkgs --simulate ## DEV
|
sudo apt update && sudo apt install --install-suggests -y $pkgs --simulate ## DEV
|
||||||
|
|
@ -36,32 +36,36 @@ else
|
||||||
break
|
break
|
||||||
|
|
||||||
elif [[ "$install" == "n" || "$install" = "N" ]]; then
|
elif [[ "$install" == "n" || "$install" = "N" ]]; then
|
||||||
echo -e "\n${RED}Missing dependencies... Exiting!${CRS}\n"
|
echo -e "\n${RED} Missing dependencies... Exiting!${CRS}\n"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "\n${YEL}Invalid response... Try again...\n\nY = (Yes, install dependencies and continue)\nN = (No, don't install dependencies and exit)${CRS}\n "
|
echo -e "\n${YEL} Invalid response... Try again...\n\n Y = (Yes, install dependencies and continue)\n N = (No, don't install dependencies and exit)${CRS}\n "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### NGINX SETUP
|
### NGINX SETUP
|
||||||
|
|
||||||
|
#### CERTIFICATION
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Enable SSL and create cetrificate? (Y/n) : " installSSL
|
read -p " Enable SSL and create self signed cetrificate? (Y/n) : " installSSL
|
||||||
if [[ "$installSSL" = "" || "$installSSL" = "y" || "$installSSL" = "Y" ]]; then
|
if [[ "$installSSL" = "" || "$installSSL" = "y" || "$installSSL" = "Y" ]]; then
|
||||||
read -p "Enter path to certificates (Will be created if not present) : " cert_path
|
read -p " Enter path to certificates folder (Will be created if not present) : " cert_path
|
||||||
|
read -p " Enter file name for certificates (Without file ending) : " cert_name
|
||||||
sudo mkdir -p "$cert_path"
|
sudo mkdir -p "$cert_path"
|
||||||
echo "Folder created" ## DEV
|
echo "Folder created" ## DEV
|
||||||
read -p "Enter file name for certificates () : " cert_name
|
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}Nginx configured${CRS}\n"
|
echo -e "\n${GRN} Nginx configured${CRS}\n"
|
||||||
break
|
break
|
||||||
|
elif [[ "$installSSL" == "n" || "$installSSL" = "N" ]]; then
|
||||||
|
echo -e "\n${RED} No SSL in nginx configured${CRS}\n"
|
||||||
else
|
else
|
||||||
echo -e "\n${YEL}Invalid response... Try again...\n\nY = (Yes, install SSL certificate and continue)\nN = (No, don't install SSL certificate and continue)${CRS}\n "
|
echo -e "\n${YEL} Invalid response... Try again...\n\nY = (Yes, configure SSL certificate and continue)\nN = (No, don't configure SSL certificate and continue)${CRS}\n "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
#sudo mkdir -p /etc/nginx/ssl ;
|
### DEV STATUS
|
||||||
|
|
||||||
#sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/meshpi.key -out /etc/nginx/ssl/meshpi.crt ;
|
echo -e "${GRN}\nScript ran through...${CRS}"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue