From 00e3c1658bf1a13a507d288bb7dc722f2a10dedb Mon Sep 17 00:00:00 2001 From: Nicholas van Oudtshoorn Date: Tue, 22 Dec 2015 12:25:47 +0800 Subject: [PATCH 7/7] Bug 12549 - Hard coded font Paths ( DejaVu ) cause problems for non-Debian systems Allows for selection of DejaVu font path when installing from the command line. This is useful for non-debian distributions that don't store the fonts in the same place. Adds a new configuration variable to Makefile.PL: FONT_DIR Defaults to the Debian install location for the fonts. Test plan: 1. Run a CLI install, accepting the defaults. 2. Compare the generated koha-conf.xml to a previous install - the font path for DejaVu fonts should be the same. 3. Run another CLI install, this time choosing a custom path for the fonts 4. Check that the path selected is reflected in the koha-conf.xml file. --- Makefile.PL | 10 +++++++++- etc/koha-conf.xml | 24 ++++++++++++------------ rewrite-config.PL | 1 + 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 96d2fb7..b1a7dc6 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -240,6 +240,10 @@ Directory for external Koha plugins. Directory for PazPar2 configuration files. +=item FONT_DIR + +Directory where DejaVu fonts are installed. + =item NONE This is a dummy target used to explicitly state @@ -442,7 +446,8 @@ my %config_defaults = ( 'PATH_TO_ZEBRA' => '', 'USE_MEMCACHED' => 'no', 'MEMCACHED_SERVERS' => '127.0.0.1:11211', - 'MEMCACHED_NAMESPACE' => 'KOHA' + 'MEMCACHED_NAMESPACE' => 'KOHA', + 'FONT_DIR' => '/usr/share/fonts/truetype/ttf-dejavu' ); # set some default configuration options based on OS @@ -1081,6 +1086,9 @@ Memcached namespace?); $config{'MEMCACHED_NAMESPACE'} = _get_value('MEMCACHED_NAMESPACE', $msg, $defaults->{'MEMCACHED_NAMESPACE'}, $valid_values, $install_log_values); } + $msg = q( +Path to DejaVu fonts?); + $config{'FONT_DIR'} = _get_value('FONT_DIR', $msg, $defaults->{'FONT_DIR'}, $valid_values, $install_log_values); $msg = q( diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml index 427680d..d20b974 100644 --- a/etc/koha-conf.xml +++ b/etc/koha-conf.xml @@ -118,18 +118,18 @@ __PAZPAR2_TOGGLE_XML_POST__ - /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf - /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Bold.ttf - /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-Italic.ttf - /usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif-BoldItalic.ttf - /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf - /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf - /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Oblique.ttf - /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-BoldOblique.ttf - /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf - /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Oblique.ttf - /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf - /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-BoldOblique.ttf + __FONT_DIR__/DejaVuSerif.ttf + __FONT_DIR__/DejaVuSerif-Bold.ttf + __FONT_DIR__/DejaVuSerif-Italic.ttf + __FONT_DIR__/DejaVuSerif-BoldItalic.ttf + __FONT_DIR__/DejaVuSansMono.ttf + __FONT_DIR__/DejaVuSansMono-Bold.ttf + __FONT_DIR__/DejaVuSansMono-Oblique.ttf + __FONT_DIR__/DejaVuSansMono-BoldOblique.ttf + __FONT_DIR__/DejaVuSans.ttf + __FONT_DIR__/DejaVuSans-Oblique.ttf + __FONT_DIR__/DejaVuSans-Bold.ttf + __FONT_DIR__/DejaVuSans-BoldOblique.ttf diff --git a/rewrite-config.PL b/rewrite-config.PL index 91f74cb..5eb5ab5 100644 --- a/rewrite-config.PL +++ b/rewrite-config.PL @@ -147,6 +147,7 @@ $prefix = $ENV{'INSTALL_BASE'} || "/usr"; "__USE_MEMCACHED__" => 'no', "__MEMCACHED_SERVERS__" => "", "__MEMCACHED_NAMESPACE__" => "", + "__FONT_DIR__" => "/usr/share/fonts/truetype/ttf-dejavu", ); # Override configuration from the environment -- 2.4.3