summaryrefslogtreecommitdiff
path: root/tools/hibyos_nativepatcher/patch_manifest.pl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/hibyos_nativepatcher/patch_manifest.pl')
-rwxr-xr-xtools/hibyos_nativepatcher/patch_manifest.pl27
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
5my $md5 = $ARGV[0];
6my $updatefile = $ARGV[1];
7my $bootloader_manif =
8"bootloader={
9 name=uboot
10 file_path=autoupdate/uboot.bin
11 md5=$md5
12}\n";
13
14# read in existing manifest
15open(FH, '<', "$updatefile");
16read(FH, my $manifest, -s FH);
17close(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
25open(FH, '>', "$updatefile");
26print FH $manifest;
27close(FH);