From 6555e41532f90b54a385dbfc322d6caf32966bae Mon Sep 17 00:00:00 2001 From: Marco Dinis Date: Mon, 30 Oct 2023 17:17:49 +0000 Subject: [PATCH 1/2] Installer Scripts: use bash instead of sh The agentless version of this script uses `bash`. Using `bash` over `sh` should help the maitenance of the script. It's being used for the agentless version and the node join script `sh` is sometimes an alias to `bash`, and testing this script in those systems might lead to assume that the script is working fine, even tho when running in a real `sh` it will fail. --- api/types/installers/installer.sh.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/types/installers/installer.sh.tmpl b/api/types/installers/installer.sh.tmpl index 6121abf9179fa..d290e44ac529b 100644 --- a/api/types/installers/installer.sh.tmpl +++ b/api/types/installers/installer.sh.tmpl @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash set -eu From e05b5c9a18d97930b64494dd31da6cad86f92a54 Mon Sep 17 00:00:00 2001 From: Marco Dinis Date: Mon, 30 Oct 2023 17:49:00 +0000 Subject: [PATCH 2/2] use the same expression that is being used in agentless --- api/types/installers/installer.sh.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/types/installers/installer.sh.tmpl b/api/types/installers/installer.sh.tmpl index d290e44ac529b..ab4f7032f127f 100644 --- a/api/types/installers/installer.sh.tmpl +++ b/api/types/installers/installer.sh.tmpl @@ -50,7 +50,7 @@ on_gcp() { sudo apt-get install -y ${PACKAGE_LIST} elif [ "$ID" = "amzn" ] || [ "$ID" = "rhel" ]; then if [ "$ID" = "rhel" ]; then - VERSION_ID=$(echo "$VERSION_ID" | sed 's/\..*//') # convert version numbers like '7.2' to only include the major version + VERSION_ID=${VERSION_ID//\.*/} # convert version numbers like '7.2' to only include the major version fi sudo yum-config-manager --add-repo \ "$(rpm --eval "https://yum.releases.teleport.dev/$ID/$VERSION_ID/Teleport/%{_arch}/{{ .RepoChannel }}/teleport.repo")" @@ -59,7 +59,7 @@ on_gcp() { if [ "$ID" = "opensuse-tumbleweed" ]; then VERSION_ID="15" # tumbleweed uses dated VERSION_IDs like 20230702 else - VERSION_ID=$(echo "$VERSION_ID" | sed 's/\..*//') # convert version numbers like '7.2' to only include the major version + VERSION_ID="${VERSION_ID//.*/}" # convert version numbers like '7.2' to only include the major version fi sudo rpm --import "https://zypper.releases.teleport.dev/gpg" sudo zypper --non-interactive addrepo "$(rpm --eval "https://zypper.releases.teleport.dev/sles/$VERSION_ID/Teleport/%{_arch}/{{ .RepoChannel }}/teleport.repo")"