From 47da0ae1cdbd8626d70a3e308d03b128897e1719 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Tue, 31 Dec 2019 17:07:33 +0100 Subject: [PATCH] Unbreak the KUAL extension (#5715) * Prefer our own FBInk binary * Get rid of the CRe config tweaks * Oops, actually ship libkohelper in the KUAL extension. * Bump extension version * Flush to disk before printing final status message --- Makefile | 2 +- .../extensions/koreader/bin/koreader-ext.sh | 72 ++----------------- .../kindle/extensions/koreader/config.xml | 2 +- platform/kindle/extensions/koreader/menu.json | 60 ---------------- platform/kindle/libkohelper.sh | 4 +- 5 files changed, 10 insertions(+), 130 deletions(-) diff --git a/Makefile b/Makefile index 5419af5cb..0f4ecb61b 100644 --- a/Makefile +++ b/Makefile @@ -181,7 +181,7 @@ kindleupdate: all ln -sf ../$(KINDLE_DIR)/launchpad $(INSTALL_DIR)/ ln -sf ../../$(KINDLE_DIR)/koreader.sh $(INSTALL_DIR)/koreader ln -sf ../../$(KINDLE_DIR)/libkohelper.sh $(INSTALL_DIR)/koreader - ln -sf ../../../../$(KINDLE_DIR)/libkohelper.sh $(INSTALL_DIR)/extensions/koreader/bin + ln -sf ../../../../../$(KINDLE_DIR)/libkohelper.sh $(INSTALL_DIR)/extensions/koreader/bin ln -sf ../../$(COMMON_DIR)/spinning_zsync $(INSTALL_DIR)/koreader # create new package cd $(INSTALL_DIR) && pwd && \ diff --git a/platform/kindle/extensions/koreader/bin/koreader-ext.sh b/platform/kindle/extensions/koreader/bin/koreader-ext.sh index 6a5e33117..e7007dd91 100755 --- a/platform/kindle/extensions/koreader/bin/koreader-ext.sh +++ b/platform/kindle/extensions/koreader/bin/koreader-ext.sh @@ -22,7 +22,7 @@ logmsg() { f_log I koreader kual "" "${1}" fi - # And handle user visual feedback via eips... + # And handle user visual feedback via FBInk/eips... eips_print_bottom_centered "${1}" 1 } @@ -78,10 +78,14 @@ update_koreader() { fail=$? fi if [ $fail -eq 0 ]; then - logmsg "Update to v${koreader_pkg_ver} successful :)" # Cleanup behind us... rm -f "${found_koreader_package}" + # Flush to disk first... + sync + logmsg "Update to v${koreader_pkg_ver} successful :)" else + # Flush to disk first anyway... + sync logmsg "Failed to update to v${koreader_pkg_ver} :(" fi fi @@ -93,55 +97,6 @@ install_koreader() { update_koreader "clean" } -# Handle cre's settings... -set_cre_prop() { - # We need at least two args - if [ $# -lt 2 ]; then - logmsg "not enough arg passed to set_cre_prop" - return - fi - - cre_prop_key="${1}" - cre_prop_value="${2}" - - cre_config="/mnt/us/koreader/data/cr3.ini" - - # Check that the config exists... - if [ -f "${cre_config}" ]; then - # dos2unix - # shellcheck disable=SC2039 - sed -e "s/$(echo -ne '\r')$//g" -i "${cre_config}" - - # And finally set the prop - if sed -re "s/^(${cre_prop_key})(=)(.*?)$/\1\2${cre_prop_value}/" -i "${cre_config}"; then - logmsg "Set ${cre_prop_key} to ${cre_prop_value}" - else - logmsg "Failed to set ${cre_prop_key}" - fi - else - logmsg "No CRe config, launch CRe once first" - fi -} - -# Handle CRe's font.hinting.mode -cre_autohint() { - set_cre_prop "font.hinting.mode" "2" -} -cre_bci() { - set_cre_prop "font.hinting.mode" "1" -} -cre_nohinting() { - set_cre_prop "font.hinting.mode" "0" -} - -# Handle CRe's font.kerning.enabled -cre_kerning() { - set_cre_prop "font.kerning.enabled" "1" -} -cre_nokerning() { - set_cre_prop "font.kerning.enabled" "0" -} - ## Main case "${1}" in "update_koreader") @@ -150,21 +105,6 @@ case "${1}" in "install_koreader") ${1} ;; - "cre_autohint") - ${1} - ;; - "cre_bci") - ${1} - ;; - "cre_nohinting") - ${1} - ;; - "cre_kerning") - ${1} - ;; - "cre_nokerning") - ${1} - ;; *) logmsg "invalid action (${1})" ;; diff --git a/platform/kindle/extensions/koreader/config.xml b/platform/kindle/extensions/koreader/config.xml index bab5a033d..3144bfe79 100644 --- a/platform/kindle/extensions/koreader/config.xml +++ b/platform/kindle/extensions/koreader/config.xml @@ -2,7 +2,7 @@ KOReader - 1.0 + 1.1 KOReader Dev Team KOReader diff --git a/platform/kindle/extensions/koreader/menu.json b/platform/kindle/extensions/koreader/menu.json index 7b301cdfa..5be795ed5 100644 --- a/platform/kindle/extensions/koreader/menu.json +++ b/platform/kindle/extensions/koreader/menu.json @@ -79,66 +79,6 @@ "refresh": false, "status": false, "internal": "status Try to install KOreader from scratch . . ." - }, - { - "name": "CRe font hinting: Autohint", - "if": "\"/mnt/us/koreader/data/cr3.ini\" -f \"/mnt/us/koreader/data/cr3.ini\" \"font.hinting.mode=2\" -g! &&", - "priority": 3, - "action": "./bin/koreader-ext.sh", - "params": "cre_autohint", - "exitmenu": false, - "checked": true, - "refresh": true, - "status": false, - "internal": "status Setup CRe to use autohinting" - }, - { - "name": "CRe font hinting: BCI", - "if": "\"/mnt/us/koreader/data/cr3.ini\" -f \"/mnt/us/koreader/data/cr3.ini\" \"font.hinting.mode=1\" -g! &&", - "priority": 4, - "action": "./bin/koreader-ext.sh", - "params": "cre_bci", - "exitmenu": false, - "checked": true, - "refresh": true, - "status": false, - "internal": "status Setup CRe to use bytecode hinting" - }, - { - "name": "CRe font hinting: None", - "if": "\"/mnt/us/koreader/data/cr3.ini\" -f \"/mnt/us/koreader/data/cr3.ini\" \"font.hinting.mode=0\" -g! &&", - "priority": 5, - "action": "./bin/koreader-ext.sh", - "params": "cre_nohinting", - "exitmenu": false, - "checked": true, - "refresh": true, - "status": false, - "internal": "status Setup CRe to forgo font hinting" - }, - { - "name": "Enable CRe font kerning", - "if": "\"/mnt/us/koreader/data/cr3.ini\" -f \"/mnt/us/koreader/data/cr3.ini\" \"font.kerning.enabled=1\" -g! &&", - "priority": 6, - "action": "./bin/koreader-ext.sh", - "params": "cre_kerning", - "exitmenu": false, - "checked": true, - "refresh": true, - "status": false, - "internal": "status Setup CRe to enable kerning" - }, - { - "name": "Disable CRe font kerning", - "if": "\"/mnt/us/koreader/data/cr3.ini\" -f \"/mnt/us/koreader/data/cr3.ini\" \"font.kerning.enabled=0\" -g! &&", - "priority": 7, - "action": "./bin/koreader-ext.sh", - "params": "cre_nokerning", - "exitmenu": false, - "checked": true, - "refresh": true, - "status": false, - "internal": "status Setup CRe to disable kerning" } ] } diff --git a/platform/kindle/libkohelper.sh b/platform/kindle/libkohelper.sh index 0b34bc3d7..62fa36f20 100644 --- a/platform/kindle/libkohelper.sh +++ b/platform/kindle/libkohelper.sh @@ -18,7 +18,7 @@ fi ## Check if we have an FBInk binary available somewhere... # Default to something that won't horribly blow up... FBINK_BIN="true" -for my_dir in libkh/bin koreader linkss/bin linkfonts/bin usbnet/bin; do +for my_dir in koreader libkh/bin linkss/bin linkfonts/bin usbnet/bin; do my_fbink="/mnt/us/${my_dir}/fbink" if [ -x "${my_fbink}" ]; then FBINK_BIN="${my_fbink}" @@ -38,7 +38,7 @@ has_fbink() { return 1 } -# NOTE: Yeah, the name becomes a bit of a lie now that we're exclusively using FBInk ;p. +# NOTE: Yeah, the name becomes a bit of a lie now that we're (hopefully) exclusively using FBInk ;p. eips_print_bottom_centered() { # We need at least two args if [ $# -lt 2 ]; then