42 lines
1.2 KiB
R
42 lines
1.2 KiB
R
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
|
|
)
|
|
} else if (grepl("rhel", 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)
|
|
}
|
|
|
|
set_bin_path <- function(r_version_minor, build_for_minor, local_build_root, codename) {
|
|
if (is.null(r_version_minor) && !build_for_minor) {
|
|
path <- sprintf(
|
|
"%s/__linux__/%s/latest/src/contrib",
|
|
local_build_root, codename
|
|
)
|
|
} else {
|
|
path <- sprintf(
|
|
"%s/__linux__/%s/%s/latest/src/contrib",
|
|
local_build_root, codename, r_version_minor
|
|
)
|
|
}
|
|
|
|
return(path)
|
|
}
|