Received: from list by lists.gnu.org with archive (Exim 4.71) id 1eqanN-00067o-4v for mharc-grub-devel@gnu.org; Tue, 27 Feb 2018 03:39:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqanK-00064i-FJ for grub-devel@gnu.org; Tue, 27 Feb 2018 03:39:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqanI-0001wQ-Kd for grub-devel@gnu.org; Tue, 27 Feb 2018 03:39:30 -0500 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::1]:15416) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eqanI-0001tQ-4p for grub-devel@gnu.org; Tue, 27 Feb 2018 03:39:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1519720764; s=strato-dkim-0002; d=aepfle.de; h=Content-Transfer-Encoding:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=I8Suvr2gAo9Ndsrt9B44GT8Sr2F68AfYOqKbeVBHx6o=; b=Q9QTPhjsEWZt/sJKwsGsRd1X23KwEZozcdwL5L6HRqdYsERzTqI8TmPbVePq5N7XLR I5tOh2AiC1kl75OYYys3WEJfdAj+Gfa6/JQ2D2jVD1OnYJsJgyqgONgaXZuqDUmvjDw0 P6i4wYRtoG2Pxq61kBgKLuVMKXmjUmJPE813r5/JehxH0OCo8miuV7BPDf0SiPkeseYq uwlgDo9LuQ5rU2Wgl7TnubqH10J6NCeWbGmUDjBZlBcswnzHAnf1km+aoBc7zOj1OweK ePVDRw2GhwuL8vrC1mzgn+pQAvT9DxoowCoWXsII+89Q0tRvR76pmbirtdR9uW35gGQv aBpg== X-RZG-AUTH: :P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QXkBR9MXjAuzpIG0mv9coXAgc1+lb4Esstf6UEufFpy8L/NK2kKUAyDFSMDbcP X-RZG-CLASS-ID: mo00 Received: from sender ([2001:a62:816:91ff:a572:884d:f51d:1a86]) by smtp.strato.de (RZmta 42.19 AUTH) with ESMTPSA id L0854au1R8dOMet (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Tue, 27 Feb 2018 09:39:24 +0100 (CET) From: Olaf Hering To: grub-devel@gnu.org Cc: Olaf Hering Subject: [PATCH] grub-install: locale depends on nls Date: Tue, 27 Feb 2018 09:39:20 +0100 Message-Id: <20180227083920.24703-1-olaf@aepfle.de> X-Mailer: git-send-email 2.16.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 2a01:238:20a:202:5300::1 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Feb 2018 08:39:32 -0000 With --disable-nls no locales exist. Avoid runtime error by wrapping install logic inside ENABLE_NLS. Signed-off-by: Olaf Hering --- util/grub-install-common.c | 108 +++++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 49 deletions(-) --- a/util/grub-install-common.c +++ b/util/grub-install-common.c @@ -725,13 +725,69 @@ grub_install_get_platform_platform (enum grub_install_plat platid) return platforms[platid].platform; } +static void +grub_install_copy_nls(const char *src, const char *dst) +{ +#if (defined (GRUB_UTIL) && defined(ENABLE_NLS) && ENABLE_NLS) + char *dst_locale; + + dst_locale = grub_util_path_concat (2, dst, "locale"); + grub_install_mkdir_p (dst_locale); + clean_grub_dir (dst_locale); + + if (install_locales.is_default) + { + char *srcd = grub_util_path_concat (2, src, "po"); + copy_by_ext (srcd, dst_locale, ".mo", 0); + copy_locales (dst_locale); + free (srcd); + } + else + { + const char *locale_dir = get_localedir (); + + for (i = 0; i < install_locales.n_entries; i++) + { + char *srcf = grub_util_path_concat_ext (3, src, + "po", + install_locales.entries[i], + ".mo"); + char *dstf = grub_util_path_concat_ext (2, dst_locale, + install_locales.entries[i], + ".mo"); + if (grub_install_compress_file (srcf, dstf, 0)) + { + free (srcf); + free (dstf); + continue; + } + free (srcf); + srcf = grub_util_path_concat_ext (4, + locale_dir, + install_locales.entries[i], + "LC_MESSAGES", + PACKAGE, + ".mo"); + if (grub_install_compress_file (srcf, dstf, 0)) + { + free (srcf); + free (dstf); + continue; + } + grub_util_error (_("cannot find locale `%s'"), + install_locales.entries[i]); + } + } + free (dst_locale); +#endif +} void grub_install_copy_files (const char *src, const char *dst, enum grub_install_plat platid) { - char *dst_platform, *dst_locale, *dst_fonts; + char *dst_platform, *dst_fonts; const char *pkgdatadir = grub_util_get_pkgdatadir (); char *themes_dir; @@ -742,13 +798,12 @@ grub_install_copy_files (const char *src, dst_platform = grub_util_path_concat (2, dst, platform); free (platform); } - dst_locale = grub_util_path_concat (2, dst, "locale"); dst_fonts = grub_util_path_concat (2, dst, "fonts"); grub_install_mkdir_p (dst_platform); - grub_install_mkdir_p (dst_locale); clean_grub_dir (dst); clean_grub_dir (dst_platform); - clean_grub_dir (dst_locale); + + grub_install_copy_nls(src, dst); if (install_modules.is_default) copy_by_ext (src, dst_platform, ".mod", 1); @@ -797,50 +852,6 @@ grub_install_copy_files (const char *src, free (dstf); } - if (install_locales.is_default) - { - char *srcd = grub_util_path_concat (2, src, "po"); - copy_by_ext (srcd, dst_locale, ".mo", 0); - copy_locales (dst_locale); - free (srcd); - } - else - { - const char *locale_dir = get_localedir (); - - for (i = 0; i < install_locales.n_entries; i++) - { - char *srcf = grub_util_path_concat_ext (3, src, - "po", - install_locales.entries[i], - ".mo"); - char *dstf = grub_util_path_concat_ext (2, dst_locale, - install_locales.entries[i], - ".mo"); - if (grub_install_compress_file (srcf, dstf, 0)) - { - free (srcf); - free (dstf); - continue; - } - free (srcf); - srcf = grub_util_path_concat_ext (4, - locale_dir, - install_locales.entries[i], - "LC_MESSAGES", - PACKAGE, - ".mo"); - if (grub_install_compress_file (srcf, dstf, 0)) - { - free (srcf); - free (dstf); - continue; - } - grub_util_error (_("cannot find locale `%s'"), - install_locales.entries[i]); - } - } - if (install_themes.is_default) { install_themes.is_default = 0; @@ -903,7 +914,6 @@ grub_install_copy_files (const char *src, } free (dst_platform); - free (dst_locale); free (dst_fonts); }