Skip to content

Commit

Permalink
feat(native): bootstrap Oracle Linux distross
Browse files Browse the repository at this point in the history
Add script to bootstrap Oracle Linux distros.

Signed-off-by: Jagannathan Raman <[email protected]>
  • Loading branch information
jraman567 committed Dec 10, 2024
1 parent 87e4f62 commit 38b381e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
50 changes: 50 additions & 0 deletions deployments/native/bootstrap/oraclelinux.sh
Original file line number Diff line number Diff line change
@@ -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/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
go install github.com/mitchellh/protoc-gen-go-json@latest

3 changes: 2 additions & 1 deletion deployments/native/deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ function bootstrap() {
case $distrib_id in
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
Expand Down

0 comments on commit 38b381e

Please sign in to comment.