#!/bin/bash # Run this script with "(sudo) bash ". # Exit on error. #set -e # Debug set -eux nginx() { # Mostly taken from http://nginx.org/en/linux_packages.html # Continue if already installed? dpkg -l nginx && ( echo "Already installed? Continue (hit enter)?" read ) apt install -y curl gnupg2 ca-certificates lsb-release \ debian-archive-keyring openssl curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor \ | tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \ http://nginx.org/packages/debian `lsb_release -cs` nginx" \ | tee /etc/apt/sources.list.d/nginx.list echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \ | tee /etc/apt/preferences.d/99nginx apt update apt install nginx } ${1:-nginx} "$@"