summaryrefslogtreecommitdiff
path: root/tools/hiby_patcher.pl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/hiby_patcher.pl')
-rwxr-xr-xtools/hiby_patcher.pl34
1 files changed, 26 insertions, 8 deletions
diff --git a/tools/hiby_patcher.pl b/tools/hiby_patcher.pl
index e1aa30733e..9c45ce6dd3 100755
--- a/tools/hiby_patcher.pl
+++ b/tools/hiby_patcher.pl
@@ -18,8 +18,6 @@
18# need '7z', 'mkisofs', 'md5sum', 'mkfs.ubifs' 18# need '7z', 'mkisofs', 'md5sum', 'mkfs.ubifs'
19# and https://github.com/jrspruitt/ubi_reader 19# and https://github.com/jrspruitt/ubi_reader
20 20
21# Rocker: PEB size 128KiB, I/O 2048, LEBs size: 124KiB, max LEBs 1024 (?)
22
23use strict; 21use strict;
24 22
25use File::Basename; 23use File::Basename;
@@ -61,13 +59,20 @@ mkdir($isowork) || die ("Can't create '$isowork'");
61@sysargs = ("7z", "x", "-aoa", "-o$isowork", $inname); 59@sysargs = ("7z", "x", "-aoa", "-o$isowork", $inname);
62system(@sysargs); 60system(@sysargs);
63 61
64### figure out the rootfs image filename 62### figure out the rootfs image filenames
65my $updatename; 63my $updatename;
66if ( -e "$isowork/UPDATE.TXT") { 64if ( -e "$isowork/UPDATE.TXT") {
67 $updatename = "$isowork/UPDATE.TXT"; 65 $updatename = "$isowork/UPDATE.TXT";
68} elsif ( -e "$isowork/update.txt") { 66} elsif ( -e "$isowork/update.txt") {
69 $updatename = "$isowork/update.txt"; 67 $updatename = "$isowork/update.txt";
70} 68}
69my $versionname;
70if ( -e "$isowork/VERSION.TXT") {
71 $versionname = "$isowork/VERSION.TXT";
72} elsif ( -e "$isowork/version.txt") {
73 $versionname = "$isowork/version.txt";
74}
75
71open UPDATE, $updatename || die ("Can't open update.txt!");; 76open UPDATE, $updatename || die ("Can't open update.txt!");;
72 77
73my $rootfs_found = 0; 78my $rootfs_found = 0;
@@ -137,16 +142,14 @@ system("mv $ubinamenew $ubiname");
137 142
138### Generate new ISO9660 update image 143### Generate new ISO9660 update image
139 144
140# Update version string as needed XXX 145# Correct md5sum for new rootfs image
141 146open UPDATE, "<$updatename" || die ("Can't open update.txt!");
142open UPDATE, "<$updatename" || die ("Can't open update.txt!");; 147open UPDATEO, ">$updatename.new" || die ("Can't open update.txt!");
143open UPDATEO, ">$updatename.new" || die ("Can't open update.txt!");;
144 148
145$rootfs_found = 0; 149$rootfs_found = 0;
146while (<UPDATE>) { 150while (<UPDATE>) {
147 if ($rootfs_found) { 151 if ($rootfs_found) {
148 if (s/md5=.*/md5=$md5/) { 152 if (s/md5=.*/md5=$md5/) {
149 print "#### $_ ####\n";
150 $rootfs_found=0; 153 $rootfs_found=0;
151 } 154 }
152 } else { 155 } else {
@@ -159,6 +162,21 @@ while (<UPDATE>) {
159close UPDATE; 162close UPDATE;
160close UPDATEO; 163close UPDATEO;
161system("mv $updatename.new $updatename"); 164system("mv $updatename.new $updatename");
165
166# Fix up version text, if needed (AGPTek Rocker 1.31 beta)
167
168open UPDATE, "<$versionname" || die ("Can't open version.txt!");;
169open UPDATEO, ">$versionname.new" || die ("Can't open version.txt!");
170
171while (<UPDATE>) {
172 s/ver=1\.0\.0\.0/ver=2018-10-07T00:00:00+08:00/;
173 print UPDATEO;
174}
175
176close UPDATE;
177close UPDATEO;
178system("mv $versionname.new $versionname");
179
162@sysargs = ("mkisofs", "-volid", "CDROM", "-o", $uptnamenew, $isowork); 180@sysargs = ("mkisofs", "-volid", "CDROM", "-o", $uptnamenew, $isowork);
163system(@sysargs); 181system(@sysargs);
164 182