ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/pbcdedit/pbcdedit
(Generate patch)

Comparing pbcdedit/pbcdedit (file contents):
Revision 1.70 by root, Sun Sep 8 16:50:39 2019 UTC vs.
Revision 1.76 by root, Tue Aug 9 11:44:54 2022 UTC

19# along with this program. If not, see <https://www.gnu.org/licenses/>. 19# along with this program. If not, see <https://www.gnu.org/licenses/>.
20# 20#
21 21
22use 5.016; # numerous features need 5.14, __SUB__ needs 5.16 22use 5.016; # numerous features need 5.14, __SUB__ needs 5.16
23 23
24our $VERSION = '1.4'; 24our $VERSION = '1.5';
25our $JSON_VERSION = 3; # the version of the json objects generated by this program 25our $JSON_VERSION = 3; # the version of the json objects generated by this program
26 26
27our $CHANGELOG = <<EOF; 27our $CHANGELOG = <<EOF;
28 28
291.5 Mon Nov 25 15:54:34 CET 2019
30 - add "del" edit instruction.
29 - work around lsblk bug sometimes giving "dos" pttype for gpt partitions. 31 - work around lsblk bug sometimes giving "dos" pttype for gpt partitions.
30 - bootmenupolicy in synopsis must be set to 0 for text menu. 32 - bootmenupolicy in synopsis must be set to 0 to get the text menu.
31 - minor doc fxes. 33 - minor doc fxes.
34 - disable use of perldoc for help, doesn't work well.
32 35
331.4 Thu Aug 22 10:48:22 CEST 2019 361.4 Thu Aug 22 10:48:22 CEST 2019
34 - new "create" subcommand. 37 - new "create" subcommand.
35 - "create" and "edit" try to save and restore ownership/permissions 38 - "create" and "edit" try to save and restore ownership/permissions
36 of bcd hives when writing the new file. 39 of bcd hives when writing the new file.
330 333
331=head2 The C<meta> key 334=head2 The C<meta> key
332 335
333The C<meta> key is not stored in the BCD data store but is used only 336The C<meta> key is not stored in the BCD data store but is used only
334by PBCDEDIT. It is always generated when exporting, and importing will 337by PBCDEDIT. It is always generated when exporting, and importing will
335be refused when it exists and the version stored inside doesn't store 338be refused when it exists and the version stored inside doesn't match
336the JSON schema version of PBCDEDIT. This ensures that different and 339the JSON schema version of PBCDEDIT. This ensures that different and
337incompatible versions of PBCDEDIT will not read and misinterpret each 340incompatible versions of PBCDEDIT will not read and misinterpret each
338others data. 341others data.
339 342
340=head2 The object keys 343=head2 The object keys
349 352
350Some of these GUIDs are fixed well known GUIDs which PBCDEDIT will decode 353Some of these GUIDs are fixed well known GUIDs which PBCDEDIT will decode
351into human-readable strings such as C<{globalsettings}>, which is the same 354into human-readable strings such as C<{globalsettings}>, which is the same
352as C<{7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}>. 355as C<{7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}>.
353 356
354Each BCD, object has an associated type. For example, 357Each BCD object has an associated type. For example,
355C<application::osloader> for objects loading Windows via F<winload.exe>, 358C<application::osloader> for objects loading Windows via F<winload.exe>,
356C<application::bootsector> for real mode applications and so on. 359C<application::bootsector> for real mode applications and so on.
357 360
358The type of a object is stored in the pseudo BCD element C<type> (see next 361The type of a object is stored in the pseudo BCD element C<type> (see next
359section). 362section).
710 713
711Probably not yet implemented. Tell me of your needs... 714Probably not yet implemented. Tell me of your needs...
712 715
713=back 716=back
714 717
718=back
719
715=head4 Examples 720=head4 Examples
716 721
717This concludes the syntax overview for device elements, but probably 722This concludes the syntax overview for device elements, but probably
718leaves many questions open. I can't help with most of them, as I also have 723leaves many questions open. I can't help with most of them, as I also have
719many questions, but I can walk you through some actual examples using more 724many questions, but I can walk you through some actual examples using more
720complex aspects. 725complex aspects.
726
727=over
721 728
722=item C<< locate=<block=vhd,<block=file,<locate=<null>,path,\disk.vhdx>,\disk.vhdx>>,element,path >> 729=item C<< locate=<block=vhd,<block=file,<locate=<null>,path,\disk.vhdx>,\disk.vhdx>>,element,path >>
723 730
724Just like with C declarations, you best treat device descriptors as 731Just like with C declarations, you best treat device descriptors as
725instructions to find your device and work your way from the inside out: 732instructions to find your device and work your way from the inside out:
797I don't know what the purpose of the C<< <1> >> flag value is, but it 804I don't know what the purpose of the C<< <1> >> flag value is, but it
798seems to be always there on this kind of entry. 805seems to be always there on this kind of entry.
799 806
800If you have some good examples to add here, feel free to mail me. 807If you have some good examples to add here, feel free to mail me.
801 808
809=back
810
802 811
803=head1 EDITING BCD STORES 812=head1 EDITING BCD STORES
804 813
805The C<edit> and C<parse> subcommands allow you to read a BCD data store 814The C<edit> and C<parse> subcommands allow you to read a BCD data store
806and modify it or extract data from it. This is done by executing a series 815and modify it or extract data from it. This is done by executing a series
825 834
826Example: change the bootmgr default too 835Example: change the bootmgr default too
827C<{b097d2ad-bc00-11e9-8a9a-525400123456}>: 836C<{b097d2ad-bc00-11e9-8a9a-525400123456}>:
828 837
829 pbcdedit edit BCD set "{bootmgr}" default "{b097d2ad-bc00-11e9-8a9a-525400123456}" 838 pbcdedit edit BCD set "{bootmgr}" default "{b097d2ad-bc00-11e9-8a9a-525400123456}"
839
840=item C<del> I<object> I<element>
841
842Similar to C<get>, but removed the BCD element from the specified BCD object.
830 843
831=item C<eval> I<perlcode> 844=item C<eval> I<perlcode>
832 845
833This takes the next argument, interprets it as Perl code and 846This takes the next argument, interprets it as Perl code and
834evaluates it. This allows you to do more complicated modifications or 847evaluates it. This allows you to do more complicated modifications or
2469 2482
2470 $object = $object eq "{default}" ? $default : dec_wguid enc_wguid $object; 2483 $object = $object eq "{default}" ? $default : dec_wguid enc_wguid $object;
2471 2484
2472 $bcd->{$object}{$elem} = $value; 2485 $bcd->{$object}{$elem} = $value;
2473 2486
2487 } elsif ($insn eq "del") {
2488 my $object = shift @insns;
2489 my $elem = shift @insns;
2490
2491 $object = $object eq "{default}" ? $default : dec_wguid enc_wguid $object;
2492
2493 delete $bcd->{$object}{$elem};
2494
2474 } elsif ($insn eq "eval") { 2495 } elsif ($insn eq "eval") {
2475 my $perl = shift @insns; 2496 my $perl = shift @insns;
2476 bcd_edit_eval "#line 1 'eval'\n$perl"; 2497 bcd_edit_eval "#line 1 'eval'\n$perl";
2477 2498
2478 } elsif ($insn eq "do") { 2499 } elsif ($insn eq "do") {
2479 my $path = shift @insns; 2500 my $path = shift @insns;
2480 my $file = file_load $path; 2501 my $file = file_load $path;
2481 bcd_edit_eval "#line 1 '$path'\n$file"; 2502 bcd_edit_eval "#line 1 '$path'\n$file";
2482 2503
2483 } else { 2504 } else {
2484 die "$insn: not a recognized instruction for edit/parse\n"; 2505 die "$insn: not a recognized instruction for create/edit/parse\n";
2485 } 2506 }
2486 } 2507 }
2487 2508
2488} 2509}
2489 2510
2552# command line parser 2573# command line parser
2553 2574
2554our %CMD = ( 2575our %CMD = (
2555 help => sub { 2576 help => sub {
2556 require Pod::Usage; 2577 require Pod::Usage;
2557 Pod::Usage::pod2usage (-verbose => 2); 2578 Pod::Usage::pod2usage (-verbose => 2, -quotes => "none", -noperldoc => 1);
2558 }, 2579 },
2559 2580
2560 objects => sub { 2581 objects => sub {
2561 my %rbcd_types = reverse %bcd_types; 2582 my %rbcd_types = reverse %bcd_types;
2562 $_ = sprintf "%08x", $_ for values %rbcd_types; 2583 $_ = sprintf "%08x", $_ for values %rbcd_types;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines