nginx.sh updated
This commit is contained in:
parent
4a541f8798
commit
e4f985d07f
1 changed files with 33 additions and 3 deletions
36
assets/shell/create_certificate.sh
Normal file → Executable file
36
assets/shell/create_certificate.sh
Normal file → Executable file
|
|
@ -1,7 +1,37 @@
|
|||
#!/usr/bin/bash
|
||||
#!/bin/bash
|
||||
|
||||
sudo mkdir -p /etc/nginx/ssl ;
|
||||
### DEPENDENCY CHECK
|
||||
|
||||
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/meshpi.key -out /etc/nginx/ssl/meshpi.crt ;
|
||||
bin="openssl"
|
||||
|
||||
echo -e "\nDependency and Privilege Check running...\n"
|
||||
|
||||
if (( $(id -u) == 0 )); then
|
||||
echo -e "Privilege check passed...\n"
|
||||
|
||||
else
|
||||
echo -e "Privilege check failed... Please run script with sudo or as root!\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if command -v "$bin" >/dev/null 2>&1; then
|
||||
echo -e "Dependency check passed...\n"
|
||||
|
||||
else
|
||||
echo -e "$bin is not installed.\n"
|
||||
read -p "Do you wish to install $bin via APT? : " install
|
||||
|
||||
if [$install == yY]; then
|
||||
sudo apt update && sudo apt install -y $bin
|
||||
echo -e "\n$bin installed. Proceeding...\n"
|
||||
|
||||
elif [$install == nN]; then
|
||||
echo -e "Dependencies not installed... Exiting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
#sudo mkdir -p /etc/nginx/ssl ;
|
||||
|
||||
#sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/meshpi.key -out /etc/nginx/ssl/meshpi.crt ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue