Skip to content

Commit

Permalink
exec rather than sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
mtelvers committed Feb 28, 2024
1 parent c8a984e commit b3fc229
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/overlayfs_store.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ let ( / ) = Filename.concat

module Overlayfs = struct
let create ?mode dirs = match mode with
| None -> Os.sudo ([ "mkdir"; "-p" ] @ dirs)
| Some mode -> Os.sudo ([ "mkdir"; "-p"; "-m"; mode ] @ dirs)
| None -> Os.exec ([ "mkdir"; "-p" ] @ dirs)
| Some mode -> Os.exec ([ "mkdir"; "-p"; "-m"; mode ] @ dirs)

let delete dirs = match dirs with
| [] -> Lwt.return_unit
| d -> Os.sudo ([ "rm"; "-rf" ] @ d)
| d -> Os.exec ([ "rm"; "-rf" ] @ d)

let overlay ~lower ~upper ~work ~merged =
Os.sudo [ "mount"; "-t"; "overlay"; "overlay"; "-olowerdir=" ^ lower ^ ",upperdir=" ^ upper ^ ",workdir=" ^ work; merged; ]

let cp ~src ~dst = Os.sudo [ "cp"; "-plRdnT"; src; dst ]
let cp ~src ~dst = Os.exec [ "cp"; "-plRdnT"; src; dst ]

let umount ~merged = Os.sudo [ "umount"; merged ]
end
Expand Down

0 comments on commit b3fc229

Please sign in to comment.