File tree 2 files changed +20
-5
lines changed
2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,23 @@ impl InstallationState {
245
245
Self :: dd_submarine ( blockdev) ?;
246
246
InstallationType :: set_cgpt_flags ( blockdev) ?;
247
247
}
248
+
249
+ tracing:: info!( "Cleaning up state..." ) ;
250
+
251
+ if let Some ( _key) = & self . encryption_key {
252
+ std:: fs:: remove_file ( keyfile) // don't care if it fails
253
+ . unwrap_or_else ( |e| tracing:: warn!( "Failed to remove keyfile: {e}" ) ) ;
254
+
255
+ // Close all mapped LUKS devices if exists
256
+
257
+ if let Ok ( mut cache) = super :: repart_output:: MAPPER_CACHE . try_write ( ) {
258
+ if let Some ( cache) = std:: sync:: Arc :: get_mut ( & mut cache) {
259
+ cache. clear ( ) ;
260
+ }
261
+ }
262
+
263
+ }
264
+
248
265
tracing:: info!( "install() finished" ) ;
249
266
Ok ( ( ) )
250
267
}
Original file line number Diff line number Diff line change 1
1
use bytesize:: ByteSize ;
2
2
use color_eyre:: eyre:: { Context , OptionExt } ;
3
- use lsblk:: Populate ;
4
3
use std:: path:: PathBuf ;
5
4
use std:: { fmt:: Write , sync:: Arc } ;
6
5
use sys_mount:: MountFlags ;
7
6
use tiffin:: { Container , MountTarget } ;
8
7
9
- use crate :: INSTALLATION_STATE ;
10
8
use crate :: {
11
9
backend:: repartcfg:: { FileSystem , RepartConfig } ,
12
10
util:: sys:: check_uefi,
@@ -48,15 +46,15 @@ impl MapperCache {
48
46
}
49
47
}
50
48
51
- fn get ( & self , node : & str ) -> Option < & PathBuf > {
49
+ pub ( crate ) fn get ( & self , node : & str ) -> Option < & PathBuf > {
52
50
self . cache . get ( node)
53
51
}
54
52
55
- fn insert ( & mut self , node : String , path : PathBuf ) {
53
+ pub ( crate ) fn insert ( & mut self , node : String , path : PathBuf ) {
56
54
self . cache . insert ( node, path) ;
57
55
}
58
56
59
- fn clear ( & mut self ) {
57
+ pub ( crate ) fn clear ( & mut self ) {
60
58
for ( node, path) in self . cache . drain ( ) {
61
59
if let Err ( e) = cryptsetup_close ( & path. to_string_lossy ( ) ) {
62
60
tracing:: error!( ?node, ?e, "Failed to close mapper device" ) ;
You can’t perform that action at this time.
0 commit comments