refactor: setup, add debian support
This commit is contained in:
parent
67cf40d623
commit
c1a8541394
@ -2,6 +2,9 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
trap trapexit EXIT SIGTERM
|
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)
|
TEMPDIR=$(mktemp -d)
|
||||||
TEMPLOG="$TEMPDIR/tmplog"
|
TEMPLOG="$TEMPDIR/tmplog"
|
||||||
TEMPERR="$TEMPDIR/tmperr"
|
TEMPERR="$TEMPDIR/tmperr"
|
||||||
@ -68,7 +71,7 @@ fi
|
|||||||
log "Installing dependencies"
|
log "Installing dependencies"
|
||||||
runcmd apt-get update
|
runcmd apt-get update
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
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
|
# Install Python
|
||||||
log "Installing python"
|
log "Installing python"
|
||||||
@ -86,9 +89,12 @@ runcmd pip install --no-cache-dir cffi certbot
|
|||||||
# Install openresty
|
# Install openresty
|
||||||
log "Installing openresty"
|
log "Installing openresty"
|
||||||
wget -qO - https://openresty.org/package/pubkey.gpg | apt-key add -
|
wget -qO - https://openresty.org/package/pubkey.gpg | apt-key add -
|
||||||
_distro_release=$(lsb_release -sc)
|
_distro_release=$(wget $WGETOPT "http://openresty.org/package/$DISTRO_ID/dists/" -O - | grep -o "$DISTRO_CODENAME" | head -n1 || true)
|
||||||
_distro_release=$(wget $WGETOPT "http://openresty.org/package/ubuntu/dists/" -O - | grep -o "$_distro_release" | head -n1 || true)
|
if [ $DISTRO_ID = "ubuntu" ]; then
|
||||||
echo "deb [trusted=yes] http://openresty.org/package/ubuntu ${_distro_release:-focal} main" | tee /etc/apt/sources.list.d/openresty.list
|
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
|
runcmd apt-get update && apt-get install -y -q --no-install-recommends openresty
|
||||||
|
|
||||||
# Install nodejs
|
# Install nodejs
|
@ -8,18 +8,23 @@ if [ "$(uname)" != "Linux" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
DISTRO=$(cat /etc/*-release | grep -w ID | cut -d= -f2 | tr -d '"')
|
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"
|
echo "DISTRO NOT SUPPORTED"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
INSTALL_SCRIPT=$DISTRO
|
||||||
|
if [ "$DISTRO" = "ubuntu" ]; then
|
||||||
|
INSTALL_SCRIPT="debian"
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf $TMP
|
rm -rf $TMP
|
||||||
wget -O "$TMP" "$URL/$DISTRO.sh"
|
wget -O "$TMP" "$URL/$INSTALL_SCRIPT.sh"
|
||||||
|
|
||||||
chmod +x "$TMP"
|
chmod +x "$TMP"
|
||||||
|
|
||||||
if [ "$(command -v bash)" ]; then
|
if [ "$(command -v bash)" ]; then
|
||||||
sudo bash "$TMP"
|
$(command -v sudo) bash "$TMP"
|
||||||
else
|
else
|
||||||
sh "$TMP"
|
sh "$TMP"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user