diff options
Diffstat (limited to 'tools/hibyos_nativepatcher/patch_manifest.pl')
-rwxr-xr-x | tools/hibyos_nativepatcher/patch_manifest.pl | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/hibyos_nativepatcher/patch_manifest.pl b/tools/hibyos_nativepatcher/patch_manifest.pl new file mode 100755 index 0000000000..82c6378c65 --- /dev/null +++ b/tools/hibyos_nativepatcher/patch_manifest.pl | |||
@@ -0,0 +1,27 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # add bootloader info to update manifest | ||
3 | # usage: ./patch_manifest.pl <md5sum> <path/to/update.txt> | ||
4 | |||
5 | my $md5 = $ARGV[0]; | ||
6 | my $updatefile = $ARGV[1]; | ||
7 | my $bootloader_manif = | ||
8 | "bootloader={ | ||
9 | name=uboot | ||
10 | file_path=autoupdate/uboot.bin | ||
11 | md5=$md5 | ||
12 | }\n"; | ||
13 | |||
14 | # read in existing manifest | ||
15 | open(FH, '<', "$updatefile"); | ||
16 | read(FH, my $manifest, -s FH); | ||
17 | close(FH); | ||
18 | |||
19 | # delete existing bootloader entry if exists | ||
20 | $manifest =~ s/bootloader\s*=\s*{[^}]*}//; | ||
21 | |||
22 | # add our own bootloader entry | ||
23 | $manifest = "$bootloader_manif$manifest"; | ||
24 | |||
25 | open(FH, '>', "$updatefile"); | ||
26 | print FH $manifest; | ||
27 | close(FH); | ||