@@ -9,28 +9,34 @@ use std::path::{Path, PathBuf};
9
9
struct ConfigPaths {
10
10
persistent : PathBuf ,
11
11
runtime : PathBuf ,
12
+ system : Option < PathBuf > ,
12
13
}
13
14
14
15
/// 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>
17
18
fn get_config_paths ( ) -> & ' static ConfigPaths {
18
19
static PATHS : OnceCell < ConfigPaths > = OnceCell :: new ( ) ;
19
20
PATHS . get_or_init ( || {
20
21
let mut r = if rustix:: process:: getuid ( ) == rustix:: process:: Uid :: ROOT {
21
22
ConfigPaths {
22
23
persistent : PathBuf :: from ( "/etc" ) ,
23
24
runtime : PathBuf :: from ( "/run" ) ,
25
+ system : PathBuf :: from ( "/usr/lib" ) . into ( ) ,
24
26
}
25
27
} else {
26
28
ConfigPaths {
27
29
persistent : glib:: user_config_dir ( ) ,
28
30
runtime : glib:: user_runtime_dir ( ) ,
31
+ system : None ,
29
32
}
30
33
} ;
31
34
let path = "ostree" ;
32
35
r. persistent . push ( path) ;
33
36
r. runtime . push ( path) ;
37
+ if let Some ( system) = r. system . as_mut ( ) {
38
+ system. push ( path) ;
39
+ }
34
40
r
35
41
} )
36
42
}
@@ -49,6 +55,12 @@ impl ConfigPaths {
49
55
if let Some ( f) = crate :: container_utils:: open_optional ( & persistent) ? {
50
56
return Ok ( Some ( ( persistent, f) ) ) ;
51
57
}
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
+ }
52
64
Ok ( None )
53
65
}
54
66
}
0 commit comments