diff --git a/tools/generate_firmware_patterns b/tools/generate_firmware_patterns index 5e4ffec2..847b097f 100755 --- a/tools/generate_firmware_patterns +++ b/tools/generate_firmware_patterns @@ -34,16 +34,6 @@ GetOptions( "output-dir=s" => \$output_dir, "verbose" => \$verbose ) or die "Error in command line arguments"; -if (! -d $output_dir) { - print STDERR "creating output directory $output_dir\n" - if $verbose; - make_path($output_dir, { verbose => $verbose }); -} - -write_file("$output_dir/README.txt", - "These files help Debian Installer detect helpful firmware packages (via hw-detect).\n"); - -process_components($_) for @ARGV; sub process_components { my $input = shift; @@ -86,3 +76,20 @@ sub process_components { @{ $array->{Provides}->{modaliases} }); } } + + +# Prepare output directory: +if (! -d $output_dir) { + print STDERR "creating output directory $output_dir\n" + if $verbose; + make_path($output_dir, { verbose => $verbose }); +} + +write_file("$output_dir/README.txt", + "These files help Debian Installer detect helpful firmware packages (via hw-detect).\n"); + +# Generate a .patterns file for each firmware package found in +# Components-* files: +foreach my $component (@ARGV) { + process_components($component); +}