#!/bin/bash ### DEPENDENCY CHECK 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" while true; do read -p "Do you wish to install $bin via APT? (Y/n) : " install if [[ "$install" = "" || "$install" = "y" || "$install" = "Y" ]]; then sudo apt update && sudo apt install --install-suggests -y $bin echo -e "\n$bin installed. Proceeding...\n" break elif [[ "$install" == "n" || "$install" = "N" ]]; then echo -e "Dependencies not installed... Exiting" exit 1 else echo -e "Invalid response... Try again...\n\nY = (Yes install $bin)\nN = (No, don't install dependencies and exit)\n " fi done 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 ;