Skip to content

Commit e9b16f8

Browse files
authored
Merge pull request bootc-dev#614 from cgwalters/fetch-usrlib-too
Support /usr/lib/ostree/auth.json
2 parents 8d972c1 + 2d1aa89 commit e9b16f8

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

lib/src/globals.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,34 @@ use std::path::{Path, PathBuf};
99
struct ConfigPaths {
1010
persistent: PathBuf,
1111
runtime: PathBuf,
12+
system: Option<PathBuf>,
1213
}
1314

1415
/// Get the runtime and persistent config directories. In the system (root) case, these
15-
/// system(root) case: /run/ostree /etc/ostree
16-
/// user(nonroot) case: /run/user/$uid/ostree ~/.config/ostree
16+
/// system(root) case: /run/ostree /etc/ostree /usr/lib/ostree
17+
/// user(nonroot) case: /run/user/$uid/ostree ~/.config/ostree <none>
1718
fn get_config_paths() -> &'static ConfigPaths {
1819
static PATHS: OnceCell<ConfigPaths> = OnceCell::new();
1920
PATHS.get_or_init(|| {
2021
let mut r = if rustix::process::getuid() == rustix::process::Uid::ROOT {
2122
ConfigPaths {
2223
persistent: PathBuf::from("/etc"),
2324
runtime: PathBuf::from("/run"),
25+
system: PathBuf::from("/usr/lib").into(),
2426
}
2527
} else {
2628
ConfigPaths {
2729
persistent: glib::user_config_dir(),
2830
runtime: glib::user_runtime_dir(),
31+
system: None,
2932
}
3033
};
3134
let path = "ostree";
3235
r.persistent.push(path);
3336
r.runtime.push(path);
37+
if let Some(system) = r.system.as_mut() {
38+
system.push(path);
39+
}
3440
r
3541
})
3642
}
@@ -49,6 +55,12 @@ impl ConfigPaths {
4955
if let Some(f) = crate::container_utils::open_optional(&persistent)? {
5056
return Ok(Some((persistent, f)));
5157
}
58+
if let Some(mut system) = self.system.clone() {
59+
system.push(p);
60+
if let Some(f) = crate::container_utils::open_optional(&system)? {
61+
return Ok(Some((system, f)));
62+
}
63+
}
5264
Ok(None)
5365
}
5466
}

man/ostree-container-auth.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ The OSTree container stack uses the same file formats as **containers-auth(5)**
99
not the same locations.
1010

1111
When running as uid 0 (root), the tooling uses `/etc/ostree/auth.json` first, then looks
12-
in `/run/ostree/auth.json`. For any other uid, the file paths used are in `${XDG_RUNTIME_DIR}/ostree/auth.json`.
12+
in `/run/ostree/auth.json`, and finally checks `/usr/lib/ostree/auth.json`.
13+
For any other uid, the file paths used are in `${XDG_RUNTIME_DIR}/ostree/auth.json`.
1314

1415
In the future, it is likely that a path that is supported for both "system podman"
1516
usage and ostree will be added.

0 commit comments

Comments
 (0)