Skip to content

Commit

Permalink
chore: Use consistent syntax for getting information from os-release
Browse files Browse the repository at this point in the history
Please tell me if I escaped quotes correctly in `drivers.rs`
  • Loading branch information
fiftydinar authored and gmpinder committed Dec 13, 2024
1 parent 78959ef commit 974ba34
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion process/drivers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ fn get_version_run_image(oci_ref: &Reference) -> Result<u64> {
.args(bon::vec![
"/bin/bash",
"-c",
"grep -Po '(?<=VERSION_ID=)\\d+' /usr/lib/os-release",
r#"awk -F= '/^VERSION_ID=/ {gsub(/"/, "", $2); print $2}' /usr/lib/os-release"#,
])
.pull(true)
.remove(true)
Expand Down
2 changes: 1 addition & 1 deletion scripts/exports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ color_string() {
}

# Parse OS version and export it
export OS_VERSION="$(grep -Po "(?<=VERSION_ID=)\d+" /usr/lib/os-release)"
export OS_VERSION="$(awk -F= '/^VERSION_ID=/ {gsub(/"/, "", $2); print $2}' /usr/lib/os-release)"
export OS_ARCH="$(uname -m)"

# Export functions for use in sub-shells or sourced scripts
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

if [ -f /etc/os-release ]; then
export ID="$(cat /etc/os-release | grep -E '^ID=' | awk -F '=' '{print $2}')"
export ID="$(awk -F= '/^ID=/ {gsub(/"/, "", $2); print $2}' /etc/os-release)"

if [ "$ID" = "alpine" ]; then
echo "Setting up Alpine based image to run BlueBuild modules"
Expand Down

0 comments on commit 974ba34

Please sign in to comment.