1
+ use std:: process:: Command ;
2
+
1
3
use anyhow:: { anyhow, bail, Context , Result } ;
4
+ use bootc_utils:: CommandRunExt ;
2
5
use camino:: Utf8Path ;
3
6
use fn_error_context:: context;
4
7
5
- use crate :: task:: Task ;
6
8
use bootc_blockdev:: PartitionTable ;
7
9
use bootc_mount as mount;
8
10
@@ -22,16 +24,15 @@ pub(crate) fn install_via_bootupd(
22
24
23
25
let srcroot = rootfs. join ( deployment_path) ;
24
26
let devpath = device. path ( ) ;
25
- let args = [ "backend" , "install" , "--write-uuid" ]
26
- . into_iter ( )
27
- . chain ( verbose)
28
- . chain ( bootupd_opts. iter ( ) . copied ( ) . flatten ( ) )
29
- . chain ( [ "--src-root" , srcroot. as_str ( ) ] )
30
- . chain ( [ "--device" , devpath. as_str ( ) , rootfs. as_str ( ) ] ) ;
31
- Task :: new ( "Running bootupctl to install bootloader" , "bootupctl" )
32
- . args ( args)
33
- . verbose ( )
34
- . run ( )
27
+ println ! ( "Installing bootloader via bootupd" ) ;
28
+ Command :: new ( "bootupctl" )
29
+ . args ( [ "backend" , "install" , "--write-uuid" ] )
30
+ . args ( verbose)
31
+ . args ( bootupd_opts. iter ( ) . copied ( ) . flatten ( ) )
32
+ . args ( [ "--src-root" , srcroot. as_str ( ) ] )
33
+ . args ( [ "--device" , devpath. as_str ( ) , rootfs. as_str ( ) ] )
34
+ . log_debug ( )
35
+ . run_inherited_with_cmd_context ( )
35
36
}
36
37
37
38
#[ context( "Installing bootloader using zipl" ) ]
@@ -97,8 +98,8 @@ pub(crate) fn install_via_zipl(device: &PartitionTable, boot_uuid: &str) -> Resu
97
98
let ramdisk = boot_dir. join ( initrd) . canonicalize_utf8 ( ) ?;
98
99
99
100
// Execute the zipl command to install bootloader
100
- let zipl_desc = format ! ( "running zipl to install bootloader on {device_path}" ) ;
101
- let zipl_task = Task :: new ( & zipl_desc , "zipl" )
101
+ println ! ( "Running zipl on {device_path}" ) ;
102
+ Command :: new ( "zipl" )
102
103
. args ( [ "--target" , boot_dir. as_str ( ) ] )
103
104
. args ( [ "--image" , image. as_str ( ) ] )
104
105
. args ( [ "--ramdisk" , ramdisk. as_str ( ) ] )
@@ -107,6 +108,7 @@ pub(crate) fn install_via_zipl(device: &PartitionTable, boot_uuid: &str) -> Resu
107
108
. args ( [ "--targettype" , "SCSI" ] )
108
109
. args ( [ "--targetblocksize" , "512" ] )
109
110
. args ( [ "--targetoffset" , & boot_part_offset. to_string ( ) ] )
110
- . args ( [ "--add-files" , "--verbose" ] ) ;
111
- zipl_task. verbose ( ) . run ( ) . context ( zipl_desc)
111
+ . args ( [ "--add-files" , "--verbose" ] )
112
+ . log_debug ( )
113
+ . run_inherited_with_cmd_context ( )
112
114
}
0 commit comments