-
-
Save AndreaCirilloAC/d3fdd8c702dd055bc58a879fb1d91def to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
updateR(admin_password = "os_admin_user_password") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(devtools) | |
install_github('andreacirilloac/updateR') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stopifnot(.Platform$OS.type == "unix") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page <- read_html(page_source) | |
version_block <- rvest::html_nodes(page,"h1+ p a+ a , table:nth-child(8) tr:nth-child(1) td > a") | |
filename <- rvest::html_text(version_block) %>% strsplit("\n", fixed = TRUE) # the resulting value is a list | |
filename <- filename[[2]] # we take the second element, containing the name of the file | |
filename_quoted <- paste("'",filename,"'",sep = "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url <- paste(page_source,filename, sep = "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
download.file(url,filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command <- paste("echo " , admin_password, "| sudo -S installer -pkg ", filename_quoted , " -target / -verbose") | |
system(command) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment