@@ -36,7 +36,7 @@ pub(crate) struct Storage {
36
36
pub physical_root : Dir ,
37
37
38
38
/// The OSTree storage
39
- pub sysroot : SysrootLock ,
39
+ ostree : SysrootLock ,
40
40
/// The composefs storage
41
41
pub composefs : OnceCell < Arc < ComposefsRepository > > ,
42
42
/// The containers-image storage used foR LBIs
@@ -56,7 +56,7 @@ impl Deref for Storage {
56
56
type Target = SysrootLock ;
57
57
58
58
fn deref ( & self ) -> & Self :: Target {
59
- & self . sysroot
59
+ & self . ostree
60
60
}
61
61
}
62
62
@@ -82,21 +82,32 @@ impl Storage {
82
82
83
83
Ok ( Self {
84
84
physical_root,
85
- sysroot,
85
+ ostree : sysroot,
86
86
run,
87
87
composefs : Default :: default ( ) ,
88
88
imgstore : Default :: default ( ) ,
89
89
} )
90
90
}
91
91
92
+ /// Access the underlying ostree repository
93
+ pub ( crate ) fn get_ostree ( & self ) -> Result < & SysrootLock > {
94
+ Ok ( & self . ostree )
95
+ }
96
+
97
+ /// Access the underlying ostree repository
98
+ pub ( crate ) fn get_ostree_cloned ( & self ) -> Result < ostree:: Sysroot > {
99
+ let r = self . get_ostree ( ) ?;
100
+ Ok ( ( * r) . clone ( ) )
101
+ }
102
+
92
103
/// Access the image storage; will automatically initialize it if necessary.
93
104
pub ( crate ) fn get_ensure_imgstore ( & self ) -> Result < & crate :: imgstorage:: Storage > {
94
105
if let Some ( imgstore) = self . imgstore . get ( ) {
95
106
return Ok ( imgstore) ;
96
107
}
97
- let sysroot_dir = crate :: utils:: sysroot_dir ( & self . sysroot ) ?;
108
+ let sysroot_dir = crate :: utils:: sysroot_dir ( & self . ostree ) ?;
98
109
99
- let sepolicy = if self . sysroot . booted_deployment ( ) . is_none ( ) {
110
+ let sepolicy = if self . ostree . booted_deployment ( ) . is_none ( ) {
100
111
// fallback to policy from container root
101
112
// this should only happen during cleanup of a broken install
102
113
tracing:: trace!( "falling back to container root's selinux policy" ) ;
@@ -106,8 +117,8 @@ impl Storage {
106
117
// load the sepolicy from the booted ostree deployment so the imgstorage can be
107
118
// properly labeled with /var/lib/container/storage labels
108
119
tracing:: trace!( "loading sepolicy from booted ostree deployment" ) ;
109
- let dep = self . sysroot . booted_deployment ( ) . unwrap ( ) ;
110
- let dep_fs = deployment_fd ( & self . sysroot , & dep) ?;
120
+ let dep = self . ostree . booted_deployment ( ) . unwrap ( ) ;
121
+ let dep_fs = deployment_fd ( & self . ostree , & dep) ?;
111
122
lsm:: new_sepolicy_at ( & dep_fs) ?
112
123
} ;
113
124
@@ -132,7 +143,7 @@ impl Storage {
132
143
133
144
// Bootstrap verity off of the ostree state. In practice this means disabled by
134
145
// default right now.
135
- let ostree_repo = & self . sysroot . repo ( ) ;
146
+ let ostree_repo = & self . ostree . repo ( ) ;
136
147
let ostree_verity = ostree_ext:: fsverity:: is_verity_enabled ( ostree_repo) ?;
137
148
if !ostree_verity. enabled {
138
149
tracing:: debug!( "Setting insecure mode for composefs repo" ) ;
@@ -147,7 +158,7 @@ impl Storage {
147
158
#[ context( "Updating storage root mtime" ) ]
148
159
pub ( crate ) fn update_mtime ( & self ) -> Result < ( ) > {
149
160
let sysroot_dir =
150
- crate :: utils:: sysroot_dir ( & self . sysroot ) . context ( "Reopen sysroot directory" ) ?;
161
+ crate :: utils:: sysroot_dir ( & self . ostree ) . context ( "Reopen sysroot directory" ) ?;
151
162
152
163
sysroot_dir
153
164
. update_timestamps ( std:: path:: Path :: new ( BOOTC_ROOT ) )
0 commit comments