boB Rudis
6 years ago
11 changed files with 178 additions and 2 deletions
@ -1,9 +1,15 @@ |
|||||
# Generated by roxygen2: do not edit by hand |
# Generated by roxygen2: do not edit by hand |
||||
|
|
||||
|
export(kernel_state) |
||||
export(read_dsstore) |
export(read_dsstore) |
||||
export(software_update_history) |
export(software_update_history) |
||||
|
export(sw_vers) |
||||
|
export(system_profile) |
||||
import(reticulate) |
import(reticulate) |
||||
import(sys) |
import(sys) |
||||
import(xml2) |
import(xml2) |
||||
importFrom(anytime,anytime) |
importFrom(anytime,anytime) |
||||
|
importFrom(purrr,"%>%") |
||||
|
importFrom(purrr,flatten_chr) |
||||
importFrom(purrr,map_df) |
importFrom(purrr,map_df) |
||||
|
importFrom(purrr,set_names) |
||||
|
@ -0,0 +1,22 @@ |
|||||
|
#' Retrieve kernel state information |
||||
|
#' |
||||
|
#' @export |
||||
|
kernel_state <- function() { |
||||
|
|
||||
|
res <- sys::exec_internal("sysctl", "-a") |
||||
|
|
||||
|
if (res$status != 0) { |
||||
|
stop("Error retrieving kernel state info. Are you on macOS?", call.=FALSE) |
||||
|
} |
||||
|
|
||||
|
out <- rawToChar(res$stdout) |
||||
|
purrr::map_df(strsplit(out, "\n")[[1]], ~{ |
||||
|
.x <- strsplit(.x, ": ", fixed = TRUE)[[1]] |
||||
|
list( |
||||
|
setting = .x[1], |
||||
|
value = .x[2] |
||||
|
) |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
#' Retrieve macOS Operating System Version Information |
||||
|
#' |
||||
|
#' @return data frame (tibble) |
||||
|
#' @export |
||||
|
sw_vers <- function() { |
||||
|
|
||||
|
res <- sys::exec_internal("sw_vers") |
||||
|
|
||||
|
if (length(res$stdout) == 0) { |
||||
|
stop('Error retrieving macOS version info. Are you running on macOS?', call.=FALSE) |
||||
|
} |
||||
|
|
||||
|
out <- rawToChar(res$stdout) |
||||
|
purrr::map_dfc(strsplit(out, "\n")[[1]], ~{ |
||||
|
.x <- strsplit(.x, "\t")[[1]] |
||||
|
as.list(purrr::set_names(.x[2], gsub(":", "", .x[1]))) |
||||
|
}) |
||||
|
|
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
#' Report system hardware and software configuration |
||||
|
#' |
||||
|
#' TODO Do more than just return an xml document once a generica plist reader |
||||
|
#' is created. |
||||
|
#' |
||||
|
#' @md |
||||
|
#' @note Even the `mini` option takes a noticeable amount of time to complete. |
||||
|
#' @param detail_level how much information to return: |
||||
|
#' - `mini` report with no personal information |
||||
|
#' - `basic` basic hardware and network information |
||||
|
#' - `full` all available information |
||||
|
#' @export |
||||
|
system_profile <- function(detail_level = c("mini", "basic", "full")) { |
||||
|
|
||||
|
match.arg( |
||||
|
tolower(trimws(detail_level[1])), |
||||
|
c("mini", "basic", "full") |
||||
|
) -> detail_level |
||||
|
|
||||
|
sys::exec_internal( |
||||
|
"system_profiler", |
||||
|
c("-xml", "-detailLevel", "mini") |
||||
|
) -> res |
||||
|
|
||||
|
if (res$status != 0) { |
||||
|
stop("Error running system profiler. Are you on macOS?", call.=FALSE) |
||||
|
} |
||||
|
|
||||
|
xml2::read_xml(res$stdout) |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,11 @@ |
|||||
|
% Generated by roxygen2: do not edit by hand |
||||
|
% Please edit documentation in R/kernel-state.R |
||||
|
\name{kernel_state} |
||||
|
\alias{kernel_state} |
||||
|
\title{Retrieve kernel state information} |
||||
|
\usage{ |
||||
|
kernel_state() |
||||
|
} |
||||
|
\description{ |
||||
|
Retrieve kernel state information |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
% Generated by roxygen2: do not edit by hand |
||||
|
% Please edit documentation in R/sw-vers.R |
||||
|
\name{sw_vers} |
||||
|
\alias{sw_vers} |
||||
|
\title{Retrieve macOS Operating System Version Information} |
||||
|
\usage{ |
||||
|
sw_vers() |
||||
|
} |
||||
|
\value{ |
||||
|
data frame (tibble) |
||||
|
} |
||||
|
\description{ |
||||
|
Retrieve macOS Operating System Version Information |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
% Generated by roxygen2: do not edit by hand |
||||
|
% Please edit documentation in R/system-profile.R |
||||
|
\name{system_profile} |
||||
|
\alias{system_profile} |
||||
|
\title{Report system hardware and software configuration} |
||||
|
\usage{ |
||||
|
system_profile(detail_level = c("mini", "basic", "full")) |
||||
|
} |
||||
|
\arguments{ |
||||
|
\item{detail_level}{how much information to return: |
||||
|
\itemize{ |
||||
|
\item \code{mini} report with no personal information |
||||
|
\item \code{basic} basic hardware and network information |
||||
|
\item \code{full} all available information |
||||
|
}} |
||||
|
} |
||||
|
\description{ |
||||
|
TODO Do more than just return an xml document once a generica plist reader |
||||
|
is created. |
||||
|
} |
||||
|
\note{ |
||||
|
Even the \code{mini} option takes a noticeable amount of time to complete. |
||||
|
} |
Loading…
Reference in new issue