1
Fork 0

Revert "try to copy the cache"

This reverts commit 9883edd911.
This commit is contained in:
Jan-Erik Rediger 2024-05-25 01:15:28 +02:00
parent 9883edd911
commit 9c6d07495c

View file

@ -78,24 +78,6 @@ fn home_dir(uid: u32) -> Vec<String> {
] ]
} }
fn copy_cache(uid: u32) -> (TempDir, Vec<String>) {
let cache_dir = format!("/run/user/{uid}/home/.cache/hare");
let tmp_cache_dir = tempfile::tempdir().unwrap();
let src_dir = "/root/.cache/hare/usr";
let opts = fs_extra::dir::CopyOptions::new();
fs_extra::copy_items(&[src_dir], tmp_cache_dir.path(), &opts).unwrap();
let tmp_cache_dir_path = tmp_cache_dir.path().display().to_string();
(tmp_cache_dir,
vec![
"--bind".to_string(),
tmp_cache_dir_path,
cache_dir,
])
}
fn shared_app_dir() -> (TempDir, Vec<String>) { fn shared_app_dir() -> (TempDir, Vec<String>) {
let tmp_app_dir = tempfile::tempdir().unwrap(); let tmp_app_dir = tempfile::tempdir().unwrap();
let app_dir_path = tmp_app_dir.path().display().to_string(); let app_dir_path = tmp_app_dir.path().display().to_string();
@ -117,7 +99,6 @@ fn command(app_file: &str) -> Vec<String> {
"/usr/bin/timeout".to_string(), DEFAULT_TIMEOUT.to_string(), "/usr/bin/timeout".to_string(), DEFAULT_TIMEOUT.to_string(),
HARE_COMMAND.to_string(), HARE_COMMAND.to_string(),
"run".to_string(), "run".to_string(),
"-v".to_string(),
app_file.to_string(), app_file.to_string(),
] ]
} }
@ -138,9 +119,6 @@ pub fn run_code(code: &str) -> std::process::Output {
let home_args = home_dir(uid); let home_args = home_dir(uid);
bwrap_cmd.args(home_args); bwrap_cmd.args(home_args);
let (_cache_dir, cache_args) = copy_cache(uid);
bwrap_cmd.args(cache_args);
let (_passwd, _group, file_args) = passwd_files(uid, gid); let (_passwd, _group, file_args) = passwd_files(uid, gid);
bwrap_cmd.args(file_args); bwrap_cmd.args(file_args);