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) {
|
||||
if (is.null(codename)) {
|
||||
if (Sys.info()["sysname"] == "Linux") {
|
||||
dist_fam <- system2("grep",
|
||||
args = c("'^ID_LIKE=' /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
|
||||
if (any(grepl("alpine", system2("cat", args = c("/etc/os-release"), stdout = TRUE)))) {
|
||||
version <- system2("grep",
|
||||
args = c("'^VERSION_ID=' /etc/os-release | cut -d'=' -f2 | tr -d '\"'"), stdout = TRUE
|
||||
)
|
||||
} 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
|
||||
version_stripped <- substr(gsub("\\.", "", version), 1, 3)
|
||||
codename <- paste0("alpine", version_stripped)
|
||||
} else {
|
||||
dist_fam <- system2("grep",
|
||||
args = c("'^ID_LIKE=' /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"
|
||||
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)) {
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue