Skip to content

Commit

Permalink
Use alternative XDG_RUNTIME_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
schaefi committed Nov 22, 2024
1 parent 295946f commit b7442f8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion common/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ impl Container {
let mut fix_run_storage = root.run("chown");
fix_run_storage.arg("-R")
.arg(chown_param)
.arg(format!("/run/user/{}/containers", user_id));
.arg(format!("/run/user/{}/containers", user_id))
.arg("/run/flakes");
FlakeLog::debug(&format!("{:?}", fix_run_storage.get_args()));
fix_run_storage.perform()?;

Expand Down
1 change: 0 additions & 1 deletion podman-pilot/registry/storage.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[storage]
driver = "overlay"
graphroot = "/usr/share/flakes/storage"
runroot = "/var/tmp/containers/storage"
rootless_storage_path = "/usr/share/flakes/storage"
5 changes: 3 additions & 2 deletions podman-pilot/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
pub const CONTAINER_DIR: &str = "/var/lib/containers";
pub const GC_THRESHOLD: i32 = 20;
pub const HOST_DEPENDENCIES: &str = "removed";
pub const PODMAN_PATH:&str = "/usr/bin/podman";
pub const FLAKES_STORAGE:&str = "/etc/flakes/storage.conf";
pub const PODMAN_PATH: &str = "/usr/bin/podman";
pub const FLAKES_STORAGE: &str = "/etc/flakes/storage.conf";
pub const FLAKES_REGISTRY: &str = "/usr/share/flakes/storage";
pub const FLAKES_REGISTRY_RUNROOT: &str = "/run/flakes";
10 changes: 10 additions & 0 deletions podman-pilot/src/podman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ pub fn create(
get_podman_ids_dir(), program_name, current_user.to_str().unwrap()
);

let container_runroot = format!(
"{}/{}",
defaults::FLAKES_REGISTRY_RUNROOT, current_user.to_str().unwrap()
);

mkdir(&container_runroot, "777", User::ROOT)?;

let mut app = user.run("podman");
app.arg("create")
.arg("--cidfile").arg(&container_cid_file);
Expand All @@ -152,6 +159,9 @@ pub fn create(
init_cid_dir()?;

env::set_var("CONTAINERS_STORAGE_CONF", defaults::FLAKES_STORAGE);
env::set_var("XDG_RUNTIME_DIR", &container_runroot);

let _ = Container::podman_setup_run_permissions();

// Check early return condition in resume mode
if Path::new(&container_cid_file).exists() && gc_cid_file(&container_cid_file, user)? && (resume || attach) {
Expand Down

0 comments on commit b7442f8

Please sign in to comment.