From f3d6fecbd5778c1dac264de916486fc40f16c8ca Mon Sep 17 00:00:00 2001 From: Gerald Pinder Date: Tue, 15 Apr 2025 17:50:54 -0400 Subject: [PATCH] fix: Get os ID with built-ins --- scripts/setup.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 5ba1675..b600616 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -1,7 +1,18 @@ #!/bin/sh if [ -f /etc/os-release ]; then - export ID="$(awk -F= '/^ID=/ {gsub(/"/, "", $2); print $2}' /etc/os-release)" + # Initialize variable to store the ID + ID="" + + # Read the /etc/os-release file line by line + while IFS== read -r key value; do + # Check if the key is 'ID' + if [ "$key" = "ID" ]; then + # Remove any quotes from the value and store it in id variable + ID=$(echo "$value" | tr -d '"') + break + fi + done < /etc/os-release if [ "$ID" = "alpine" ]; then echo "Setting up Alpine based image to run BlueBuild modules"