mirror of
https://github.com/linuxboot/linuxboot
synced 2024-11-22 08:09:41 +00:00
add -h | --help option, handle empty argument case
This commit is contained in:
parent
90a34eac18
commit
0d33925b8e
@ -8,10 +8,11 @@ use Getopt::Long;
|
|||||||
use Digest::SHA 'sha1';
|
use Digest::SHA 'sha1';
|
||||||
use EFI;
|
use EFI;
|
||||||
|
|
||||||
my $usage = <<"";
|
my $usage = <<"END";
|
||||||
Usage:
|
Usage:
|
||||||
$0 -o output.ffs [options] file.efi [...]
|
$0 -o output.ffs [options] file.efi [...]
|
||||||
Options:
|
Options:
|
||||||
|
-h | -? | --help This help
|
||||||
-o | --output output.ffs Output file (default is stdout)
|
-o | --output output.ffs Output file (default is stdout)
|
||||||
-n | --name FileName Name to include in UI Section
|
-n | --name FileName Name to include in UI Section
|
||||||
-t | --type Type FREEFORM|DRIVER|SMM|DXE_CORE|SMM_CORE|PEIM
|
-t | --type Type FREEFORM|DRIVER|SMM|DXE_CORE|SMM_CORE|PEIM
|
||||||
@ -20,6 +21,7 @@ Options:
|
|||||||
-d | --depex 'guid guid..' Optional dependencies (all ANDed, or TRUE)
|
-d | --depex 'guid guid..' Optional dependencies (all ANDed, or TRUE)
|
||||||
-z | --compress Enable LZMA compression
|
-z | --compress Enable LZMA compression
|
||||||
-a | --auto Detect the section types from the filenames
|
-a | --auto Detect the section types from the filenames
|
||||||
|
END
|
||||||
|
|
||||||
my $output = '-';
|
my $output = '-';
|
||||||
my $name;
|
my $name;
|
||||||
@ -32,6 +34,7 @@ my $auto;
|
|||||||
|
|
||||||
|
|
||||||
GetOptions(
|
GetOptions(
|
||||||
|
"h|?|help" => sub { print $usage; exit 0 },
|
||||||
"o|output=s" => \$output,
|
"o|output=s" => \$output,
|
||||||
"n|name=s" => \$name,
|
"n|name=s" => \$name,
|
||||||
"t|type=s" => \$type,
|
"t|type=s" => \$type,
|
||||||
@ -45,6 +48,8 @@ GetOptions(
|
|||||||
die "$type: unknown file type\n"
|
die "$type: unknown file type\n"
|
||||||
if $type and not exists $EFI::file_types{$type};
|
if $type and not exists $EFI::file_types{$type};
|
||||||
|
|
||||||
|
die "At least one FFS section is required\n" unless @ARGV;
|
||||||
|
|
||||||
my @sections;
|
my @sections;
|
||||||
|
|
||||||
# Read entire files at a time and append a new section
|
# Read entire files at a time and append a new section
|
||||||
|
@ -18,10 +18,11 @@ use Getopt::Long;
|
|||||||
use Digest::SHA 'sha1';
|
use Digest::SHA 'sha1';
|
||||||
use EFI;
|
use EFI;
|
||||||
|
|
||||||
my $usage = <<"";
|
my $usage = <<"END";
|
||||||
Usage:
|
Usage:
|
||||||
$0 -o output.fv [options] file.ffs [...]
|
$0 -o output.fv [options] file.ffs [...]
|
||||||
Options:
|
Options:
|
||||||
|
-h | -? | --help This help
|
||||||
-o | --output output.ffs Output file (default is stdout)
|
-o | --output output.ffs Output file (default is stdout)
|
||||||
-s | --size BYTES Final size in bytes (default is 4 MB)
|
-s | --size BYTES Final size in bytes (default is 4 MB)
|
||||||
-v | --verbose Increase verbosity
|
-v | --verbose Increase verbosity
|
||||||
@ -33,12 +34,18 @@ volume with a 8MB internal use --size 0x4000000 --compress 0x800000
|
|||||||
|
|
||||||
Sizes are limited to less than 16 MB until FFSv3 support is added.
|
Sizes are limited to less than 16 MB until FFSv3 support is added.
|
||||||
|
|
||||||
|
END
|
||||||
|
|
||||||
|
# if invoked with no options, we should probably print some help
|
||||||
|
die $usage unless @ARGV;
|
||||||
|
|
||||||
my $output = '-';
|
my $output = '-';
|
||||||
my $size = 4 * 1024 * 1024;
|
my $size = 4 * 1024 * 1024;
|
||||||
my $verbose = 0;
|
my $verbose = 0;
|
||||||
my $compress_size;
|
my $compress_size;
|
||||||
|
|
||||||
GetOptions(
|
GetOptions(
|
||||||
|
"h|?|help" => sub { print $usage; exit 0 },
|
||||||
"o|output=s" => \$output,
|
"o|output=s" => \$output,
|
||||||
"s|size=o" => \$size,
|
"s|size=o" => \$size,
|
||||||
"z|compress=o" => \$compress_size,
|
"z|compress=o" => \$compress_size,
|
||||||
|
Loading…
Reference in New Issue
Block a user