add codename support for alpine
This commit is contained in:
parent
9ffab1b63e
commit
08611e8132
1 changed files with 22 additions and 16 deletions
38
R/helpers.R
38
R/helpers.R
|
|
@ -2,28 +2,34 @@
|
||||||
set_codename <- function(codename) {
|
set_codename <- function(codename) {
|
||||||
if (is.null(codename)) {
|
if (is.null(codename)) {
|
||||||
if (Sys.info()["sysname"] == "Linux") {
|
if (Sys.info()["sysname"] == "Linux") {
|
||||||
dist_fam <- system2("grep",
|
if (any(grepl("alpine", system2("cat", args = c("/etc/os-release"), stdout = TRUE)))) {
|
||||||
args = c("'^ID_LIKE=' /etc/os-release | cut -d'=' -f2 | tr -d '\"'"), stdout = TRUE
|
version <- system2("grep",
|
||||||
)
|
args = c("'^VERSION_ID=' /etc/os-release | cut -d'=' -f2 | tr -d '\"'"), stdout = TRUE
|
||||||
if (dist_fam == "debian") {
|
|
||||||
codename <- system2("grep",
|
|
||||||
args = c("'^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2 | tr -d '\"'"), stdout = TRUE
|
|
||||||
)
|
)
|
||||||
} else if (grepl("rhel|fedora", dist_fam)) {
|
version_stripped <- substr(gsub("\\.", "", version), 1, 3)
|
||||||
platform_id <- system2("grep",
|
codename <- paste0("alpine", version_stripped)
|
||||||
args = c("'^PLATFORM_ID=' /etc/os-release | cut -d'=' -f2 | tr -d '\"'"), stdout = TRUE
|
} else {
|
||||||
|
dist_fam <- system2("grep",
|
||||||
|
args = c("'^ID_LIKE=' /etc/os-release | cut -d'=' -f2 | tr -d '\"'"), stdout = TRUE
|
||||||
)
|
)
|
||||||
if (platform_id == "platform:el9") {
|
if (dist_fam == "debian") {
|
||||||
codename <- "rhel9"
|
codename <- system2("grep",
|
||||||
} else if (platform_id == "platform:el8") {
|
args = c("'^VERSION_CODENAME=' /etc/os-release | cut -d'=' -f2 | tr -d '\"'"), stdout = TRUE
|
||||||
codename <- "rhel8"
|
)
|
||||||
|
} else if (grepl("rhel|fedora", dist_fam)) {
|
||||||
|
platform_id <- system2("grep",
|
||||||
|
args = c("'^PLATFORM_ID=' /etc/os-release | cut -d'=' -f2 | tr -d '\"'"), stdout = TRUE
|
||||||
|
)
|
||||||
|
if (platform_id == "platform:el9") {
|
||||||
|
codename <- "rhel9"
|
||||||
|
} else if (platform_id == "platform:el8") {
|
||||||
|
codename <- "rhel8"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
codename <- "unknown"
|
|
||||||
}
|
}
|
||||||
|
return(codename)
|
||||||
}
|
}
|
||||||
return(codename)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#' Helper function to set the path for binary package outputs
|
#' Helper function to set the path for binary package outputs
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue