Debian Codegraph @

R/acls.R

raw
1
2 renv_acls_reset <- function(source, target = dirname(source)) {
3
4 # only run on Linux for now
5 if (!renv_platform_linux())
6 return(FALSE)
7
8 # skip if we don't have 'getfacl', 'setfacl'
9 getfacl <- Sys.which("getfacl"); setfacl <- Sys.which("setfacl")
10 if (!nzchar(getfacl) || !nzchar(setfacl))
11 return(FALSE)
12
13 # build command
14 fmt <- "getfacl %s 2> /dev/null | setfacl -R --set-file=- %s 2> /dev/null"
15 command <- sprintf(fmt, renv_shell_path(target), renv_shell_path(source))
16
17 # execute it
18 # TODO: Should we report errors? If so, how?
19 catch(
20 renv_system_exec(
21 command = command,
22 action = "resetting ACLs",
23 quiet = TRUE
24 )
25 )
26
27 }