@ -319,6 +319,7 @@ pub(crate) fn run(opts: Options) -> Result<()> {
}
let mut kernel_images = Vec ::new ( ) ;
let mut configs = Vec ::new ( ) ;
for entry in WalkDir ::new ( archive_dir . join ( "boot" ) ) {
let entry = entry . context ( "read_dir failed" ) ? ;
if ! entry . file_type ( ) . is_file ( ) {
@ -331,6 +332,10 @@ pub(crate) fn run(opts: Options) -> Result<()> {
[ b'v' , b'm' , b'l' , b'i' , b'n' , b'u' , b'z' , b'-' , .. ] = > {
kernel_images . push ( path )
}
// "config-"
[ b'c' , b'o' , b'n' , b'f' , b'i' , b'g' , b'-' , .. ] = > {
configs . push ( path ) ;
}
_ = > { }
}
}
@ -343,6 +348,10 @@ pub(crate) fn run(opts: Options) -> Result<()> {
kernel_images
) ,
} ;
let config = match configs . as_slice ( ) {
[ config ] = > config ,
configs = > bail ! ( "multiple configs in {}: {:?}" , archive . display ( ) , configs ) ,
} ;
let mut modules_dirs = Vec ::new ( ) ;
for prefix in [ "usr/lib/modules" , "lib/modules" ] {
@ -479,9 +488,15 @@ pub(crate) fn run(opts: Options) -> Result<()> {
write_dir ( Path ::new ( "/bin" ) ) ;
write_dir ( Path ::new ( "/sbin" ) ) ;
write_dir ( Path ::new ( "/boot" ) ) ;
write_dir ( Path ::new ( "/lib" ) ) ;
write_dir ( Path ::new ( "/lib/modules" ) ) ;
write_file ( Path ::new ( "/boot/config" ) , config , "644 0 0" ) ;
if let Some ( name ) = config . file_name ( ) {
write_file ( & Path ::new ( "/boot" ) . join ( name ) , config , "644 0 0" ) ;
}
test_distro . iter ( ) . for_each ( | ( name , path ) | {
if name = = "init" {
write_file ( Path ::new ( "/init" ) , path , "755 0 0" ) ;