From 5576382d96aef6ced718d303a0542a82fd0981b7 Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Mon, 23 Sep 2024 09:34:41 +0100 Subject: [PATCH] Install OS package via faasd-pro script These packages need to be sourced by other means when installing into an airgap, and you can set SKIP_OS=1 to avoid using the Internet. Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- hack/install-pro.sh | 53 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/hack/install-pro.sh b/hack/install-pro.sh index f6232f68..43788468 100644 --- a/hack/install-pro.sh +++ b/hack/install-pro.sh @@ -5,7 +5,46 @@ if [ "$EUID" -ne 0 ]; then exit fi -echo "1. Downloading OCI image, and installing pre-requisites" +has_yum() { + [ -n "$(command -v yum)" ] +} + +has_apt_get() { + [ -n "$(command -v apt-get)" ] +} + +has_pacman() { + [ -n "$(command -v pacman)" ] +} + +install_required_packages() { + if $(has_apt_get); then + # Debian bullseye is missing iptables. Added to required packages + # to get it working in raspberry pi. No such known issues in + # other distros. Hence, adding only to this block. + # reference: https://github.com/openfaas/faasd/pull/237 + apt-get update -y + apt-get install -y curl runc bridge-utils iptables + elif $(has_yum); then + yum check-update -y + yum install -y curl runc iptables-services + elif $(has_pacman); then + pacman -Syy + pacman -Sy curl runc bridge-utils + else + fatal "Could not find apt-get, yum, or pacman. Cannot install dependencies on this OS." + exit 1 + fi +} + +echo "1. Installing required OS packages, set SKIP_OS=1 to skip this step" +echo "" + +if [ -z "$SKIP_OS" ]; then + install_required_packages +fi + +echo "2. Downloading OCI image, and installing pre-requisites" echo "" if [ ! -x "$(command -v arkade)" ]; then curl -sLS https://get.arkade.dev | sh @@ -22,21 +61,13 @@ cd ${tmpdir} ./install.sh ./ echo "" -echo "2. You now need to activate your license via GitHub" +echo "3. You now need to activate your license via GitHub" echo "" echo "sudo -E faasd github login" echo "sudo -E faasd activate" echo "" echo "" -echo "3. Then perform the final installation steps" +echo "4. Then perform the final installation steps" echo "" echo "sudo -E sh -c \"cd ${tmpdir}/var/lib/faasd && faasd install\"" echo "" -echo "4. Additional OS packages are sometimes required, with one of the below:" -echo "" -echo "apt install -qy runc bridge-utils iptables" -echo "" -echo "yum install runc iptables-services" -echo "" -echo "pacman -Sy runc bridge-utils" -