diff --git a/lxc/nginx-proxy-manager/install/ubuntu.sh b/lxc/nginx-proxy-manager/install/debian.sh similarity index 90% rename from lxc/nginx-proxy-manager/install/ubuntu.sh rename to lxc/nginx-proxy-manager/install/debian.sh index 603340a..1cc982b 100644 --- a/lxc/nginx-proxy-manager/install/ubuntu.sh +++ b/lxc/nginx-proxy-manager/install/debian.sh @@ -2,6 +2,9 @@ set -euo pipefail trap trapexit EXIT SIGTERM +DISTRO_ID=$(cat /etc/*-release | grep -w ID | cut -d= -f2 | tr -d '"') +DISTRO_CODENAME=$(cat /etc/*-release | grep -w VERSION_CODENAME | cut -d= -f2 | tr -d '"') + TEMPDIR=$(mktemp -d) TEMPLOG="$TEMPDIR/tmplog" TEMPERR="$TEMPDIR/tmperr" @@ -68,7 +71,7 @@ fi log "Installing dependencies" runcmd apt-get update export DEBIAN_FRONTEND=noninteractive -runcmd 'sudo apt-get install -y --no-install-recommends $DEVDEPS gnupg openssl ca-certificates apache2-utils logrotate' +runcmd 'apt-get install -y --no-install-recommends $DEVDEPS gnupg openssl ca-certificates apache2-utils logrotate' # Install Python log "Installing python" @@ -86,9 +89,12 @@ runcmd pip install --no-cache-dir cffi certbot # Install openresty log "Installing openresty" wget -qO - https://openresty.org/package/pubkey.gpg | apt-key add - -_distro_release=$(lsb_release -sc) -_distro_release=$(wget $WGETOPT "http://openresty.org/package/ubuntu/dists/" -O - | grep -o "$_distro_release" | head -n1 || true) -echo "deb [trusted=yes] http://openresty.org/package/ubuntu ${_distro_release:-focal} main" | tee /etc/apt/sources.list.d/openresty.list +_distro_release=$(wget $WGETOPT "http://openresty.org/package/$DISTRO_ID/dists/" -O - | grep -o "$DISTRO_CODENAME" | head -n1 || true) +if [ $DISTRO_ID = "ubuntu" ]; then + echo "deb [trusted=yes] http://openresty.org/package/$DISTRO_ID ${_distro_release:-focal} main" | tee /etc/apt/sources.list.d/openresty.list +else + echo "deb [trusted=yes] http://openresty.org/package/$DISTRO_ID ${_distro_release:-bullseye} openresty" | tee /etc/apt/sources.list.d/openresty.list +fi runcmd apt-get update && apt-get install -y -q --no-install-recommends openresty # Install nodejs diff --git a/lxc/nginx-proxy-manager/setup.sh b/lxc/nginx-proxy-manager/setup.sh index 16f7d10..a126d5a 100644 --- a/lxc/nginx-proxy-manager/setup.sh +++ b/lxc/nginx-proxy-manager/setup.sh @@ -8,18 +8,23 @@ if [ "$(uname)" != "Linux" ]; then fi DISTRO=$(cat /etc/*-release | grep -w ID | cut -d= -f2 | tr -d '"') -if [ "$DISTRO" != "alpine" ] && [ "$DISTRO" != "ubuntu" ]; then +if [ "$DISTRO" != "alpine" ] && [ "$DISTRO" != "ubuntu" ] && [ "$DISTRO" != "debian" ]; then echo "DISTRO NOT SUPPORTED" exit 1 fi +INSTALL_SCRIPT=$DISTRO +if [ "$DISTRO" = "ubuntu" ]; then + INSTALL_SCRIPT="debian" +fi + rm -rf $TMP -wget -O "$TMP" "$URL/$DISTRO.sh" +wget -O "$TMP" "$URL/$INSTALL_SCRIPT.sh" chmod +x "$TMP" if [ "$(command -v bash)" ]; then - sudo bash "$TMP" + $(command -v sudo) bash "$TMP" else sh "$TMP" fi