chore: Use consistent syntax for getting information from os-release

Please tell me if I escaped quotes correctly in `drivers.rs`
This commit is contained in:
fiftydinar 2024-12-12 08:23:14 +01:00 committed by Gerald Pinder
parent 78959eff54
commit 974ba34225
3 changed files with 3 additions and 3 deletions

View file

@ -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)

View file

@ -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

View file

@ -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"