@@ -15,6 +15,8 @@ use serde::Deserialize;
15
15
use crate :: deploy:: ImageState ;
16
16
use crate :: store:: Storage ;
17
17
18
+ const KARGS_PATH : & str = "usr/lib/bootc/kargs.d" ;
19
+
18
20
/// The kargs.d configuration file.
19
21
#[ derive( Deserialize ) ]
20
22
#[ serde( rename_all = "kebab-case" , deny_unknown_fields) ]
@@ -37,10 +39,7 @@ impl Config {
37
39
/// a combined list.
38
40
pub ( crate ) fn get_kargs_in_root ( d : & Dir , sys_arch : & str ) -> Result < Vec < String > > {
39
41
// If the directory doesn't exist, that's OK.
40
- let Some ( d) = d
41
- . open_dir_optional ( "usr/lib/bootc/kargs.d" ) ?
42
- . map ( DirUtf8 :: from_cap_std)
43
- else {
42
+ let Some ( d) = d. open_dir_optional ( KARGS_PATH ) ?. map ( DirUtf8 :: from_cap_std) else {
44
43
return Ok ( Default :: default ( ) ) ;
45
44
} ;
46
45
let mut ret = Vec :: new ( ) ;
@@ -54,6 +53,18 @@ pub(crate) fn get_kargs_in_root(d: &Dir, sys_arch: &str) -> Result<Vec<String>>
54
53
}
55
54
56
55
/// Load kargs.d files from the target ostree commit root
56
+ #[ cfg( feature = "install" ) ]
57
+ pub ( crate ) fn get_kargs_from_ostree_root (
58
+ repo : & ostree:: Repo ,
59
+ root : & ostree:: RepoFile ,
60
+ sys_arch : & str ,
61
+ ) -> Result < Vec < String > > {
62
+ let kargsd = root. resolve_relative_path ( KARGS_PATH ) ;
63
+ let kargsd = kargsd. downcast_ref :: < ostree:: RepoFile > ( ) . expect ( "downcast" ) ;
64
+ get_kargs_from_ostree ( repo, kargsd, sys_arch)
65
+ }
66
+
67
+ /// Load kargs.d files from the target dir
57
68
fn get_kargs_from_ostree (
58
69
repo : & ostree:: Repo ,
59
70
fetched_tree : & ostree:: RepoFile ,
@@ -119,7 +130,7 @@ pub(crate) fn get_kargs(
119
130
120
131
// Get the kargs in kargs.d of the pending image
121
132
let ( fetched_tree, _) = repo. read_commit ( fetched. ostree_commit . as_str ( ) , cancellable) ?;
122
- let fetched_tree = fetched_tree. resolve_relative_path ( "/usr/lib/bootc/kargs.d" ) ;
133
+ let fetched_tree = fetched_tree. resolve_relative_path ( KARGS_PATH ) ;
123
134
let fetched_tree = fetched_tree
124
135
. downcast :: < ostree:: RepoFile > ( )
125
136
. expect ( "downcast" ) ;
0 commit comments