diff --git a/deployments/aws/deployment.sh b/deployments/aws/deployment.sh index e3ca36fc..53b59182 100755 --- a/deployments/aws/deployment.sh +++ b/deployments/aws/deployment.sh @@ -62,12 +62,12 @@ function bootstrap() { Linux) # shellcheck disable=SC2002 local distrib_id - distrib_id=$(head -n 1 /dev/null | \ + distrib_id=$(cat /etc/os-release | grep -w ID | \ cut -f2 -d= | tr -d \") case $distrib_id in - Arch) sudo pacman -Syy packer ssh openssl;; - Ubuntu) + arch) sudo pacman -Syy packer ssh openssl;; + ubuntu) sudo apt update sudo apt --yes install curl openssl postgresql diff --git a/deployments/debian/deployment.sh b/deployments/debian/deployment.sh index c1aa3860..c041529a 100755 --- a/deployments/debian/deployment.sh +++ b/deployments/debian/deployment.sh @@ -15,12 +15,12 @@ function bootstrap() { Linux) # shellcheck disable=SC2002 local distrib_id - distrib_id=$(head -n 1 /dev/null | \ + distrib_id=$(cat /etc/os-release | grep -w ID | \ cut -f2 -d= | tr -d \") case $distrib_id in - Arch) sudo pacman -Syy dpkg ;; - Ubuntu) ;; + arch) sudo pacman -Syy dpkg ;; + ubuntu) ;; *) echo -e "$_error: Boostrapping is currently only supported for Arch and Ubuntu." exit diff --git a/deployments/native/bootstrap/oraclelinux.sh b/deployments/native/bootstrap/oraclelinux.sh new file mode 100755 index 00000000..0a0d0810 --- /dev/null +++ b/deployments/native/bootstrap/oraclelinux.sh @@ -0,0 +1,50 @@ +#!/bin/sh +# Copyright 2024 Contributors to the Veraison project. +# SPDX-License-Identifier: Apache-2.0 + +arch=$(arch) +req_go_version="1.22.0" +install_go="no" +go_pkg="" +step_pkg="" + +case $arch in + x86_64) + go_pkg=go1.23.4.linux-amd64.tar.gz + step_pkg=step-cli_amd64.rpm + ;; + aarch64) + go_pkg=go1.23.4.linux-arm64.tar.gz + step_pkg=step-cli_arm64.rpm + ;; + *) + echo -e "Unsupported architecture for Oracle Linux" + ;; +esac + +go=$(command -v go) +if [ "$go" == "" ]; then + install_go="yes" +fi + +if [ "$install_go" == "no" ]; then + cur_go_version=`go version | { read _ _ cur_go_version _; echo ${cur_go_version#go}; }` + if [ "$(printf '%s\n' "$goversion" "req_go_version" | sort -V | head -n1)" != "req_go_version" ]; then + install_go="yes" + fi +fi + +if [ "$install_go" == "yes" ]; then + wget https://go.dev/dl/$go_pkg -O /tmp/$go_pkg + sudo tar -C /usr/local -xzf /tmp/$go_pkg + sudo ln -s /usr/local/go/bin/go /usr/local/bin/go + sudo ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt +fi + +sudo dnf install -y --enablerepo=ol9_codeready_builder git protobuf protobuf-devel gettext sqlite openssl jq +sudo dnf install -y https://dl.smallstep.com/cli/docs-cli-install/latest/$step_pkg + +go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 +go install github.com/mitchellh/protoc-gen-go-json@latest + diff --git a/deployments/native/deployment.sh b/deployments/native/deployment.sh index 63d6d033..7b2318d0 100755 --- a/deployments/native/deployment.sh +++ b/deployments/native/deployment.sh @@ -124,13 +124,14 @@ function bootstrap() { case $( uname -s ) in Linux) # shellcheck disable=SC2002 - local distrib_id=$(cat /etc/lsb-release 2>/dev/null | head -n 1 | cut -f2 -d= | tr -d \") + local distrib_id=$(cat /etc/os-release | grep -w ID | cut -f2 -d= | tr -d \") case $distrib_id in - Arch) ${BOOTSTRAP_DIR}/arch.sh;; - Ubuntu) ${BOOTSTRAP_DIR}/ubuntu.sh;; + arch) ${BOOTSTRAP_DIR}/arch.sh;; + ubuntu) ${BOOTSTRAP_DIR}/ubuntu.sh;; + ol) ${BOOTSTRAP_DIR}/oraclelinux.sh;; *) - echo -e "$_ERROR: Boostrapping is currently only supported for Arch and Ubuntu. For other systems, please see one of the scripts in ${BOOTSTRAP_DIR}, and adapt the commmand to your system." + echo -e "$_ERROR: Boostrapping is currently only supported for Arch, Ubuntu and Oracle Linux. For other systems, please see one of the scripts in ${BOOTSTRAP_DIR}, and adapt the commmand to your system." exit ;; esac