07-22-2017, 03:06 PM | #16 | |
Resident Curmudgeon
Posts: 73,974
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
07-22-2017, 03:56 PM | #17 | |
I need a chapter break
Posts: 4,042
Karma: 56058267
Join Date: Mar 2015
Location: Israel
Device: Kobo Glo
|
Quote:
Edit: after checking, it look like there is a bug, not all the patches are showing. Last edited by oren64; 07-22-2017 at 05:34 PM. |
|
07-22-2017, 09:11 PM | #18 | |
Wizard
Posts: 2,735
Karma: 6990705
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
|
Quote:
Sent from my XT1527 using Tapatalk |
|
07-22-2017, 10:06 PM | #19 | |
Zealot
Posts: 140
Karma: 82382
Join Date: Jan 2013
Device: Kindle Paperwhite, Kobo Glo, Kobo GloHD
|
Quote:
The config file (named enabled_patches.conf) in my case is Code:
Custom left & right margins Custom page refresh options Fix three KePub fullScreenReading bugs Change dicthtml strings to micthtml Fix page breaks bug Default ePub monospace font (Courier) Custom reading footer style Dictionary frame size - beta8 Increase The Cover Size In Library Increasing The View Details Container New home screen increasing cover size Reading stats/Author name cut when the series is showing bug fix Code:
#!/usr/bin/perl $^W = 1; use strict; use File::Copy qw(copy); use Getopt::Long; my $opt_conf = 'enabled_patches.conf'; my $opt_patchdir; my $opt_help = 0; my %patches; GetOptions( "config-file|c=s" => \$opt_conf, "patch-dir|p=s" => \$opt_patchdir, "help|h|?" => \$opt_help ) || die ("Unknown option: $!"); if ($opt_help) { print "prepare-patch-files [-p <patch_dir>] [-c <config>] Prepares the Kobo patcher .patch files according to the config file, which defaults to 'enabled_patches.conf'. Format of this files is the one patch name per line, empty lines are ignored. All the patches listed in this file are activated, all others are deactivated. If the option 'patch-dir' is not given, the directory of patches is searched in the current directory under the name N.N.NNNN_source. "; exit(0); } die ("config file not readable: $opt_conf") if (! -r $opt_conf); open CONF, "<", $opt_conf || die("Cannot open $opt_conf: $!"); while (<CONF>) { s/\r?\n$//; next if (m/^\s*$/); $patches{$_} = 1; } close(CONF) || warn("Cannot close $opt_conf, continuing anyway: $!"); # search for patch dir if (!defined($opt_patchdir)) { opendir my $dh, "." || die("Cannot open '.' for reading: $!"); while (my $entry = readdir $dh) { if ($entry =~ m/^\d\.\d\.\d\d\d\d_source$/) { $opt_patchdir = $entry; print "found patch dir $opt_patchdir\n"; } } # closedir not necessary, $dh goes out of scope so handle will be closed } die ("Cannot find patch directory!") if (!defined($opt_patchdir)); opendir my $pd, $opt_patchdir || die ("Cannot open $opt_patchdir: $!"); while (my $pfname = readdir $pd) { if ($pfname =~ m/^.*\.patch$/) { copy("$opt_patchdir/$pfname", "$opt_patchdir/$pfname.orig") || die ("Cannot make backup $opt_patchdir/$pfname.orig: $!"); open (my $pfold, "<", "$opt_patchdir/$pfname.orig") || die ("Cannot open $opt_patchdir/$pfname.orig: $!"); open (my $pfnew, ">", "$opt_patchdir/$pfname") || die ("Cannot open $opt_patchdir/$pfname for writing: $!"); my $enable_patch = 0; my $patch_name; while (my $l = <$pfold>) { # we cannot use chomp as it depends on $/ and might not chop of \r $l =~ s/\r?\n$//; if ($l =~ m/^patch_name = `(.*)`\s*$/) { $patch_name = $1; # default to be disabled $enable_patch = 0; if (defined($patches{$patch_name})) { $enable_patch = 1; # memorize that we found that patch $patches{$patch_name} = 0; } print $pfnew "$l\n"; } elsif ($l =~ m/^patch_enable = `(.*)`\s*$/) { print $pfnew "patch_enable = `", ($enable_patch ? "yes" : "no"), "`\n"; print(($enable_patch ? "Enabling" : "Disabling"), " patch $patch_name\n"); } else { print $pfnew "$l\n"; } } close $pfold || warn("Cannot close $pfname.orig: $!"); close $pfnew || warn("Cannot close $pfname: $!"); } } closedir($pd); # check whether all patches to be enabled have been found my $warning = "The following patches are listed in the config file but haven't been found in any of the patches, please check them! "; my $do_warn = 0; for my $k (keys %patches) { if ($patches{$k}) { # we have set all found patches to 0, so this one wasn't found $warning .= " $k\n"; $do_warn = 1; } } print $warning if ($do_warn); print "All done.\n"; exit(0); |
|
07-23-2017, 02:05 AM | #20 |
Addict
Posts: 285
Karma: 3762916
Join Date: Nov 2011
Device: none
|
|
07-23-2017, 02:12 AM | #21 | |
Bibliophagist
Posts: 35,401
Karma: 145435140
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
Possibly a bit primitive but quick and dirty works for me. |
|
07-23-2017, 06:28 AM | #22 |
Resident Curmudgeon
Posts: 73,974
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
My way of doing it also makes sure that any third party patches are added in as when I compare and I don't see a patch I know is a third party patch, I add it in or wait for it.
|
07-24-2017, 08:45 AM | #23 | |
Guru
Posts: 856
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
|
Quote:
I do actually have an updated version based on PyQT. Looking at my github repo, I even worked on it in march Maybe I should dust it off and give it another once over. |
|
07-24-2017, 02:26 PM | #24 |
Member
Posts: 11
Karma: 10
Join Date: Aug 2011
Device: Kobo Glo HD
|
Hi,
I get this error when running the .sh on OS X stat: cannot read file system information for '%Lp': No such file or directory chmod: invalid mode: ‘File:’ Try 'chmod --help' for more information. Complete log: Created scratch directory /tmp/patch32lsb_m0m7SMyD Checking 4.5.9587_source/kobo-update-4.5.9587.zip ... Archive: 4.5.9587_source/kobo-update-4.5.9587.zip testing: KoboRoot.tgz OK No errors detected in 4.5.9587_source/kobo-update-4.5.9587.zip for the 1 file tested. Extracting files to patch from 4.5.9587_source/kobo-update-4.5.9587.zip ... x ./usr/local/Kobo/librmsdk.so.1.0.0 x ./usr/local/Kobo/nickel x ./usr/local/Kobo/libadobe.so x ./usr/local/Kobo/libnickel.so.1.0.0 Patching ./usr/local/Kobo/libadobe.so ... Read 221912 bytes from input file '/tmp/patch32lsb_m0m7SMyD/original/./usr/local/Kobo/libadobe.so' Applied patch `Remove PDF map widget shown during panning` Applied patch `Preserve PDF pan position across page turns` Wrote 221912 bytes to output file '/tmp/patch32lsb_m0m7SMyD/patched/./usr/local/Kobo/libadobe.so' stat: cannot read file system information for '%Lp': No such file or directory chmod: invalid mode: ‘File:’ Try 'chmod --help' for more information. Cleaning up scratch directory /tmp/patch32lsb_m0m7SMyD |
07-24-2017, 02:46 PM | #25 |
Member
Posts: 11
Karma: 10
Join Date: Aug 2011
Device: Kobo Glo HD
|
I did get in to run in my ubuntu vm (after chmod +x the patch32lsb-x86_64- file)
Last edited by goenieg; 07-24-2017 at 03:00 PM. |
07-24-2017, 10:28 PM | #26 | ||
Wizard
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
|
Quote:
Code:
stat --help Quote:
I don't know what is going on, but if something is messed up with th permissions it might be prudent to check the KoboRoot.tgz file that the patching script creates before copying it to the ereader. Code:
tar tvzf KoboRoot.tgz Code:
-rwxr-xr-x geoff/geoff 221912 2017-07-25 14:18 ./usr/local/Kobo/libadobe.so -rwxr-xr-x geoff/geoff 12201036 2017-07-25 14:18 ./usr/local/Kobo/libnickel.so.1.0.0 -rwxr-xr-x geoff/geoff 7284428 2017-07-25 14:18 ./usr/local/Kobo/librmsdk.so.1.0.0 -rwxr-xr-x geoff/geoff 5787328 2017-07-25 14:18 ./usr/local/Kobo/nickel |
||
07-24-2017, 10:55 PM | #27 |
Wizard
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
|
If the problem is an incompatible stat, then a workaround is to change the highlighted line in the 4.5.9587.sh scipt, from:
Code:
for F in $FILES_TO_PATCH; do
echo "Patching $F ..."
mkdir -p `dirname $NEW/$F`;
$PATCH32LSB_BIN -p $SOURCE_DIR/`basename $F`.patch -i $OLD/$F -o $NEW/$F;
chmod `$STAT $OLD/$F` $NEW/$F;
done
Code:
for F in $FILES_TO_PATCH; do
echo "Patching $F ..."
mkdir -p `dirname $NEW/$F`;
$PATCH32LSB_BIN -p $SOURCE_DIR/`basename $F`.patch -i $OLD/$F -o $NEW/$F;
chmod 0755 $NEW/$F;
done
Last edited by GeoffR; 07-24-2017 at 11:03 PM. Reason: I might make this change anyway, ... |
07-25-2017, 01:02 PM | #28 |
Evangelist
Posts: 407
Karma: 314204
Join Date: Jan 2015
Device: bq Avant XL, Kobo Aura H2O, Onyx Boox M96C Plus
|
@GeoffR
So, can zip (the program) change unix permissions of a file within an archive even from windows? |
07-25-2017, 02:32 PM | #29 |
Member
Posts: 11
Karma: 10
Join Date: Aug 2011
Device: Kobo Glo HD
|
Thank you very much Geoff,
output of stat --help Code:
x:~ micha$ stat --help Usage: stat [OPTION]... FILE... Display file or file system status. Mandatory arguments to long options are mandatory for short options too. -L, --dereference follow links -f, --file-system display file system status instead of file status -c --format=FORMAT use the specified FORMAT instead of the default; output a newline after each use of FORMAT --printf=FORMAT like --format, but interpret backslash escapes, and do not output a mandatory trailing newline; if you want a newline, include \n in FORMAT -t, --terse print the information in terse form --help display this help and exit --version output version information and exit The valid format sequences for files (without --file-system): %a access rights in octal (note '#' and '0' printf flags) %A access rights in human readable form %b number of blocks allocated (see %B) %B the size in bytes of each block reported by %b %C SELinux security context string %d device number in decimal %D device number in hex %f raw mode in hex %F file type %g group ID of owner %G group name of owner %h number of hard links %i inode number %m mount point %n file name %N quoted file name with dereference if symbolic link %o optimal I/O transfer size hint %s total size, in bytes %t major device type in hex, for character/block device special files %T minor device type in hex, for character/block device special files %u user ID of owner %U user name of owner %w time of file birth, human-readable; - if unknown %W time of file birth, seconds since Epoch; 0 if unknown %x time of last access, human-readable %X time of last access, seconds since Epoch %y time of last data modification, human-readable %Y time of last data modification, seconds since Epoch %z time of last status change, human-readable %Z time of last status change, seconds since Epoch Valid format sequences for file systems: %a free blocks available to non-superuser %b total data blocks in file system %c total file nodes in file system %d free file nodes in file system %f free blocks in file system %i file system ID in hex %l maximum length of filenames %n file name %s block size (for faster transfers) %S fundamental block size (for block counts) %t file system type in hex %T file system type in human readable form NOTE: your shell may have its own version of stat, which usually supersedes the version described here. Please refer to your shell's documentation for details about the options it supports. GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report stat translation bugs to <http://translationproject.org/team/> Full documentation at: <http://www.gnu.org/software/coreutils/stat> or available locally via: info '(coreutils) stat invocation' Last edited by goenieg; 07-25-2017 at 04:11 PM. |
07-25-2017, 02:38 PM | #30 |
Member
Posts: 11
Karma: 10
Join Date: Aug 2011
Device: Kobo Glo HD
|
Just tested it, and I can confirm that "chmod 0755 $NEW/$F;" works for OS X Sierra.
Thanks! |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Instructions for patching firmware 3.18.0 | GeoffR | Kobo Developer's Corner | 151 | 10-21-2016 06:15 AM |
Instructions for patching firmware 3.17.3 | GeoffR | Kobo Developer's Corner | 60 | 09-17-2015 05:35 PM |
Instructions for patching firmware 3.17.0 | GeoffR | Kobo Developer's Corner | 49 | 08-16-2015 05:20 AM |
Instructions for patching firmware 3.16.10 | GeoffR | Kobo Developer's Corner | 12 | 08-14-2015 03:40 AM |
Instructions for patching firmware 3.2.0 | DNSB | Kobo Developer's Corner | 66 | 12-05-2014 07:28 AM |