fix: Get os ID with built-ins
This commit is contained in:
parent
ad53cdcb8c
commit
f3d6fecbd5
1 changed files with 12 additions and 1 deletions
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue