]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Unify file copying setup across different install scripts. Add
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 4 Apr 2013 17:59:59 +0000 (19:59 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 4 Apr 2013 17:59:59 +0000 (19:59 +0200)
options for performing partial install.

ChangeLog
Makefile.util.def
gentpl.py
util/grub-install.in
util/grub-install_header [new file with mode: 0644]
util/grub-mknetdir.in
util/grub-mkrescue.in
util/grub-mkstandalone.in

index 400a07139934d7243a76a32a479be77922f95bb7..94f26315db0548e08a8b7e2c52ec54e2cd9013aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Unify file copying setup across different install scripts. Add
+       options for performing partial install.
+
 2013-04-04  Vladimir Serbinenko  <phcoder@gmail.com>
 2013-04-04  Peter Jones <pjones@redhat.com>
 
index 62bcf2db6283070dc9133fe0f0cc055b71f96556..513dc38584bcdac2d8abeddd489aaee3dea35480 100644 (file)
@@ -451,9 +451,13 @@ script = {
 script = {
   mansection = 1;
   name = grub-mkrescue;
+  x86 = util/grub-install_header;
   x86 = util/grub-mkrescue.in;
+  mips_qemu_mips = util/grub-install_header;
   mips_qemu_mips = util/grub-mkrescue.in;
+  mips_loongson = util/grub-install_header;
   mips_loongson = util/grub-mkrescue.in;
+  ia64_efi = util/grub-install_header;
   ia64_efi = util/grub-mkrescue.in;
   powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in;
   enable = i386_pc;
@@ -471,6 +475,7 @@ script = {
 script = {
   mansection = 1;
   name = grub-mkstandalone;
+  common = util/grub-install_header;
   common = util/grub-mkstandalone.in;
 };
 
@@ -479,6 +484,7 @@ script = {
   installdir = sbin;
   name = grub-install;
 
+  common = util/grub-install_header;
   common = util/grub-install.in;
   enable = noemu;
 };
@@ -488,6 +494,7 @@ script = {
   installdir = bin;
   name = grub-mknetdir;
 
+  common = util/grub-install_header;
   common = util/grub-mknetdir.in;
 };
 
index 6d7f613d19e2ee06de413f18feaf1c547b8bc28e..b159795a10381e1637bb410a1859e3b400d9189f 100644 (file)
--- a/gentpl.py
+++ b/gentpl.py
@@ -535,8 +535,8 @@ def script(platform):
     r += "[+ IF mansection +]" + manpage("grub-mkconfig_lib") + "[+ ENDIF +]"
     r += "[+ ENDIF +]"
 
-    r += rule("[+ name +]", platform_sources(platform) + " $(top_builddir)/config.status", """
-$(top_builddir)/config.status --file=$@:$<
+    r += rule("[+ name +]", "$(top_builddir)/config.status " + platform_sources(platform), """
+(skip=1; for x in $^; do if [ $$skip = 1 ]; then skip=0; else cat "$$x"; fi; done) | $(top_builddir)/config.status --file=$@:-
 chmod a+x [+ name +]
 """)
 
index 9e63cf5d9c796126f97faf2fe3a304c0006b22a3..016b16147a0fe3e0440c22c814986c8b6a8ea511 100644 (file)
@@ -88,6 +88,8 @@ usage () {
     print_option_help "-h, --help" "$(gettext "print this message and exit")"
     print_option_help "-v, --version" "$(gettext "print the version information and exit")"
     print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
+    grub_print_install_files_help
+
     dirmsg="$(gettext_printf "install GRUB images under the directory DIR/%s instead of the %s directory" "@grubdirname@" "$grubdir")"
     print_option_help "--boot-directory=$(gettext "DIR")" "$dirmsg"
     # TRANSLATORS: "TARGET" as in "target platform".
@@ -120,17 +122,6 @@ echo
 gettext "Report bugs to <bug-grub@gnu.org>."; echo
 }
 
-argument () {
-  opt="$1"
-  shift
-
-  if test $# -eq 0; then
-      gettext_printf "%s: option requires an argument -- \`%s'\n" "$0" "$opt" 1>&2
-      exit 1
-  fi
-  echo "$1"
-}
-
 allow_floppy=""
 force_file_id=
 efidir=
@@ -138,6 +129,12 @@ efidir=
 # Check the arguments.
 while test $# -gt 0
 do
+    grub_process_install_options "$@"
+    case "$grub_process_install_options_consumed" in
+       1) shift; continue;;
+       2) shift; shift; continue;;
+    esac
+
     option=$1
     shift
 
@@ -519,14 +516,8 @@ else
 fi
 
 # Copy the GRUB images to the GRUB directory.
-for file in "${grubdir}"/*.mod "${grubdir}"/*.lst "${grubdir}"/*.img "${grubdir}"/efiemu??.o "${grubdir}"/${grub_modinfo_target_cpu}-$grub_modinfo_platform/*.mod "${grubdir}"/${grub_modinfo_target_cpu}-$grub_modinfo_platform/*.lst "${grubdir}"/${grub_modinfo_target_cpu}-$grub_modinfo_platform/*.img "${grubdir}"/${grub_modinfo_target_cpu}-$grub_modinfo_platform/efiemu??.o; do
-    if test -f "$file" && [ "`basename $file`" != menu.lst ]; then
-       rm -f "$file" || exit 1
-    fi
-done
-for file in "${source_dir}"/*.mod "${source_dir}"/*.lst; do
-    cp -f "$file" "${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform" || exit 1
-done
+grub_install_files "${source_dir}" "${grubdir}" "${grub_modinfo_target_cpu}-$grub_modinfo_platform" all
+
 if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ] || [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "sparc64-ieee1275" ] ; then
     for file in "${source_dir}"/*.img "${source_dir}"/efiemu??.o; do
        if test -f "$file"; then
@@ -535,24 +526,6 @@ if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ] || [ "$
     done
 fi
 
-# Copy gettext files
-mkdir -p "${grubdir}"/locale/
-for dir in "${localedir}"/*; do
-    if test -f "$dir/LC_MESSAGES/grub.mo"; then
-        cp -f "$dir/LC_MESSAGES/grub.mo" "${grubdir}/locale/${dir##*/}.mo"
-    fi
-done
-
-if test -f "${pkgdatadir}"/themes/starfield/theme.txt; then
-    mkdir -p "${grubdir}"/themes/starfield
-    cp "${pkgdatadir}"/themes/starfield/* "${grubdir}"/themes/starfield
-fi
-
-if test -f "${pkgdatadir}"/unicode.pf2; then
-    mkdir -p "${grubdir}"/fonts
-    cp "${pkgdatadir}"/unicode.pf2 "${grubdir}"/fonts
-fi
-
 if ! is_path_readable_by_grub "${grubdir}"; then
     gettext_printf "Path \`%s' is not readable by GRUB on boot. Installation is impossible. Aborting.\n" "${grubdir}" 1>&2
     exit 1
diff --git a/util/grub-install_header b/util/grub-install_header
new file mode 100644 (file)
index 0000000..7c2c0a5
--- /dev/null
@@ -0,0 +1,161 @@
+#! /bin/sh
+set -e
+
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012  Free Software Foundation, Inc.
+#
+# GRUB is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GRUB is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+
+pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst \
+handler.lst video.lst crypto.lst terminal.lst"
+
+grub_install_files () {
+    grub_install_files_source_directory="$1"
+    grub_install_files_target_directory="$2"
+    grub_install_files_platform="$3"
+    
+    mkdir -p "${grub_install_files_target_directory}"/"${grub_install_files_platform}"
+    
+    for file in "${grub_install_files_target_directory}"/*.mod \
+"${grub_install_files_target_directory}"/*.lst \
+"${grub_install_files_target_directory}"/*.img \
+"${grub_install_files_target_directory}"/efiemu??.o \
+"${grub_install_files_target_directory}"/"${grub_install_files_platform}"/*.mod \
+"${grub_install_files_target_directory}"/"${grub_install_files_platform}"/*.lst \
+"${grub_install_files_target_directory}"/"${grub_install_files_platform}"/*.img \
+"${grub_install_files_target_directory}"/"${grub_install_files_platform}"/efiemu??.o;
+    do
+       if test -f "$file" && [ "`basename $file`" != menu.lst ]; then
+           rm -f "$file" || exit 1
+       fi
+    done
+
+    if [ x"$install_modules" = xall ]; then
+       for file in "${grub_install_files_source_directory}/"*.mod; do
+           cp -f "$file" "${grub_install_files_target_directory}"/"${grub_install_files_platform}"
+       done
+    else
+       modules1=
+       modules2="$install_modules"
+       while [ x"$modules2" != x ]; do
+           modules3=
+           for x in $modules2; do
+               modules3="$modules3 $(grep "^$x:" "${grub_install_files_source_directory}/moddep.lst" | sed 's,^[^:]*:,,')"
+           done
+           modules1="$modules1 $modules2"
+           modules2="$modules3"
+       done
+       for file in $(echo "$modules1" | sed 's, ,\n,g' |sort -u); do
+           cp -f "${grub_install_files_source_directory}/$file.mod" "${grub_install_files_target_directory}"/"${grub_install_files_platform}"
+       done
+    fi
+    
+    for file in ${pkglib_DATA} efiemu32.o efiemu64.o; do
+       if test -f "${grub_install_files_source_directory}/${file}"; then
+            cp -f "${grub_install_files_source_directory}/${file}" "${grub_install_files_target_directory}"/"${grub_install_files_platform}"
+       fi
+    done
+    
+    # Copy gettext files
+    mkdir -p "${grub_install_files_target_directory}"/locale
+
+    for file in "${grub_install_files_target_directory}"/locale/*.mo; do
+       if test -f "$file"; then
+           rm -f "$file" || exit 1
+       fi
+    done
+
+    if [ x"$install_locales" = xall ]; then
+       for file in "${grub_install_files_source_directory}"/po/*.mo; do
+           if test -f "$file"; then
+               cp -f "$file" "${grub_install_files_target_directory}"/locale/
+           fi
+       done
+       for dir in "${localedir}"/*; do
+           if test -f "$dir/LC_MESSAGES/grub.mo" && ! test -f "${grub_install_files_target_directory}"/locale/"${dir##*/}.mo"; then
+               cp -f "$dir/LC_MESSAGES/grub.mo" "${grub_install_files_target_directory}"/locale/"${dir##*/}.mo"
+           fi
+       done
+    else
+       for locale in $install_locales; do
+           if test -f "${grub_install_files_source_directory}"/po/$locale.mo; then
+               cp -f " "${grub_install_files_source_directory}"/po/$locale.mo" "${grub_install_files_target_directory}"/locale/$locale.mo
+           elif test -f "${localedir}/$locale/LC_MESSAGES/grub.mo"; then
+               cp -f "${localedir}/$locale/LC_MESSAGES/grub.mo" "${grub_install_files_target_directory}"/locale/$locale.mo
+           fi
+       done
+    fi
+    for theme in ${install_themes} ; do
+       if test -f "${pkgdatadir}"/themes/"${theme}"/theme.txt; then
+           mkdir -p "${grub_install_files_target_directory}"/themes/"${theme}"
+           cp "${pkgdatadir}"/themes/"${theme}"/* "${grub_install_files_target_directory}"/themes/"${theme}"
+       fi
+    done
+
+    for font in ${install_fonts} ; do
+       if test -f "${pkgdatadir}"/"$font".pf2; then
+           mkdir -p "${grub_install_files_target_directory}"/fonts
+           cp "${pkgdatadir}"/"$font".pf2 "${grub_install_files_target_directory}"/fonts
+       fi
+    done
+}
+
+grub_print_install_files_help () {
+    print_option_help "--install-modules=$(gettext "MODULES")" "$(gettext "install only MODULES and their dependencies [default=all]")"
+    print_option_help "--themes=THEMES" "$(gettext_printf "install THEMES [default=%s]" "starfield")"
+    print_option_help "--fonts=FONTS" "$(gettext_printf "install FONTS [default=%s]" "unicode")"
+    print_option_help "--locales=LOCALES" "$(gettext_printf "install only LOCALES [default=all]")"
+}
+
+install_modules=all
+install_themes=starfield
+install_fonts=unicode
+install_locales=all
+
+argument () {
+  opt=$1
+  shift
+
+  if test $# -eq 0; then
+      gettext_printf "%s: option requires an argument -- \`%s'\n" "$0" "$opt" 1>&2
+      exit 1
+  fi
+  echo $1
+}
+
+grub_process_install_options () {
+    option=$1
+    shift
+
+    grub_process_install_options_consumed=0
+
+    case "$option" in
+       --install-modules)
+           install_modules=`argument $option "$@"`; grub_process_install_options_consumed=2; return ;;
+       --install-modules=*)
+            install_modules=`echo "$option" | sed 's/--install-modules=//'`; grub_process_install_options_consumed=1; return ;;
+       --themes)
+           install_themes=`argument $option "$@"`; grub_process_install_options_consumed=2; return ;;
+       --themes=*)
+            install_themes=`echo "$option" | sed 's/--themes=//'`; grub_process_install_options_consumed=1; return ;;
+       --fonts)
+           install_fonts=`argument $option "$@"`; grub_process_install_options_consumed=2; return ;;
+       --fonts=*)
+            install_fonts=`echo "$option" | sed 's/--fonts=//'`; grub_process_install_options_consumed=1; return ;;
+       --locales)
+           install_locales=`argument $option "$@"`; grub_process_install_options_consumed=2; return ;;
+       --locales=*)
+            install_locales=`echo "$option" | sed 's/--locales=//'`; grub_process_install_options_consumed=1; return ;;
+    esac
+}
+
index e235af33c41f3582260aab2dbc4c951651fbdb05..6df761a388133fb67a322eb5847c699586e6b076 100644 (file)
@@ -1,5 +1,3 @@
-#! /bin/sh
-
 # Install GRUB on your drive.
 # Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
 #
@@ -26,7 +24,6 @@ PACKAGE_NAME=@PACKAGE_NAME@
 PACKAGE_TARNAME=@PACKAGE_TARNAME@
 PACKAGE_VERSION=@PACKAGE_VERSION@
 host_os=@host_os@
-pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
 datadir="@datadir@"
 if [ "x$pkgdatadir" = x ]; then
     pkgdatadir="${datadir}/@PACKAGE@"
@@ -65,6 +62,7 @@ usage () {
     print_option_help "-h, --help" "$(gettext "print this message and exit")"
     print_option_help "-v, --version" "$(gettext "print the version information and exit")"
     print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
+    grub_print_install_files_help
     print_option_help "--net-directory=$(gettext "DIR")" "$(gettext "root directory of TFTP server")"
     print_option_help "--subdir=$(gettext "DIR")" "$(gettext "relative subdirectory on network server")"
     print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
@@ -77,20 +75,15 @@ usage () {
     gettext "Report bugs to <bug-grub@gnu.org>."; echo
 }
 
-argument () {
-  opt=$1
-  shift
-
-  if test $# -eq 0; then
-      gettext_printf "%s: option requires an argument -- \`%s'\n" "$0" "$opt" 1>&2
-      exit 1
-  fi
-  echo $1
-}
-
 # Check the arguments.
 while test $# -gt 0
 do
+    grub_process_install_options "$@"
+    case "$grub_process_install_options_consumed" in
+       1) shift; continue;;
+       2) shift; shift; continue;;
+    esac
+
     option=$1
     shift
 
@@ -166,32 +159,10 @@ process_input_dir ()
     platform="$2"
     grubdir="${rootdir}/${subdir}/${platform}"
     config_opt=
-    mkdir -p "$grubdir" || exit 1
-
-    for file in "${grubdir}"/*.mod "${grubdir}"/*.lst "${grubdir}"/*.img "${grubdir}"/efiemu??.o; do
-       if test -f "$file" && [ "`basename $file`" != menu.lst ]; then
-           rm -f "$file" || exit 1
-       fi
-    done
-    for file in "${input_dir}"/*.mod; do
-        if test -f "$file"; then
-            cp -f "$file" "$grubdir/"
-        fi
-    done
-    for file in ${pkglib_DATA}; do
-       if test -f "${input_dir}/${file}"; then
-            cp -f "${input_dir}/${file}" "$grubdir/"
-       fi
-    done
 
-    mkdir -p "$grubdir/locale"
-    for file in ${input_dir}/po/*.mo; do
-        if test -f "$file"; then
-           cp -f "$file" "$grubdir/locale/"
-       fi
-    done
+    grub_install_files "${input_dir}" "${rootdir}/${subdir}" "${platform}"
 
-    rm -f ${grubdir}/load.cfg
+    rm -f "${grubdir}"/load.cfg
 
     if [ "x${debug_image}" != x ]; then
        echo "set debug='${debug_image}'" >> ${grubdir}/load.cfg
index d279a9dbab277c57b5d38f74e3a0c0fb4e826f70..c57a0d95a980c6135aedd95ebad4acc523516626 100644 (file)
@@ -1,5 +1,3 @@
-#! /bin/sh
-set -e
 
 # Make GRUB rescue image
 # Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010  Free Software Foundation, Inc.
@@ -70,6 +68,8 @@ usage () {
     print_option_help "-v, --version" "$(gettext "print the version information and exit")"
     print_option_help "-o, --output=$filetrans" "$(gettext "save output in FILE [required]")"
     print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
+    grub_print_install_files_help
+    print_option_help "--install-modules=$(gettext "MODULES")" "$(gettext "install only MODULES and their dependencies on bootable media")"
     print_option_help "--rom-directory=$(gettext "DIR")" "$(gettext "save ROM images in DIR [optional]")"
     # TRANSLATORS: xorriso is a program for creating ISOs and burning CDs
     print_option_help "--xorriso=$filetrans" "$(gettext "use FILE as xorriso [optional]")"
@@ -83,20 +83,15 @@ usage () {
     gettext "Mail xorriso support requests to <bug-xorriso@gnu.org>."; echo
 }
 
-argument () {
-  opt=$1
-  shift
-
-  if test $# -eq 0; then
-      gettext_printf "%s: option requires an argument -- \`%s'\n" "$0" "$opt" 1>&2
-      exit 1
-  fi
-  echo $1
-}
-
 # Check the arguments.
 while test $# -gt 0
 do
+    grub_process_install_options "$@"
+    case "$grub_process_install_options_consumed" in
+       1) shift; continue;;
+       2) shift; shift; continue;;
+    esac
+
     option=$1
     shift
 
@@ -171,26 +166,7 @@ mkdir -p ${iso9660_dir}/boot/grub
 
 process_input_dir ()
 {
-    input_dir="$1"
-    platform="$2"
-    mkdir -p "${iso9660_dir}/boot/grub/${platform}"
-    for file in "${input_dir}/"*.mod "${input_dir}/"efiemu32.o "${input_dir}/"efiemu64.o; do
-        if test -f "$file"; then
-            cp -f "$file" "${iso9660_dir}/boot/grub/${platform}/"
-        fi
-    done
-    for file in ${pkglib_DATA}; do
-       if test -f "${input_dir}/${file}"; then
-            cp -f "${input_dir}/${file}" "${iso9660_dir}/boot/grub/${platform}/"
-       fi
-    done
-
-    mkdir -p "${iso9660_dir}/boot/grub/locale"
-    for dir in "${localedir}"/*; do
-       if test -f "$dir/LC_MESSAGES/grub.mo"; then
-            cp -f "$dir/LC_MESSAGES/grub.mo" "${iso9660_dir}/boot/grub/locale/${dir##*/}.mo"
-       fi
-    done
+    grub_install_files "$1" "${iso9660_dir}/boot/grub" "$2"
 }
 
 make_image ()
index 78b83e0375fd541f331c72dc0c9b2638b6a23a94..a5434c4ac1f0f44e25a4d4cf57ccb87ded9b29d8 100644 (file)
@@ -1,5 +1,4 @@
-#! /bin/sh
-set -e
+#!/bin/sh
 
 # Make GRUB rescue image
 # Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012  Free Software Foundation, Inc.
@@ -27,7 +26,6 @@ libdir="@libdir@"
 PACKAGE_NAME=@PACKAGE_NAME@
 PACKAGE_TARNAME=@PACKAGE_TARNAME@
 PACKAGE_VERSION=@PACKAGE_VERSION@
-pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
 datadir="@datadir@"
 if [ "x$pkgdatadir" = x ]; then
     pkgdatadir="${datadir}/@PACKAGE@"
@@ -64,25 +62,21 @@ usage () {
     echo
     print_option_help "-C, --compression=(xz|none|auto)" "$(gettext "choose the compression to use")"
     print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
+    grub_print_install_files_help
     print_option_help  "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
     echo
     gettext "Report bugs to <bug-grub@gnu.org>."; echo
 }
 
-argument () {
-  opt=$1
-  shift
-
-  if test $# -eq 0; then
-      gettext_printf "%s: option requires an argument -- \`%s'\n" "$0" "$opt" 1>&2
-      exit 1
-  fi
-  echo $1
-}
-
 # Check the arguments.
 while test $# -gt 0
 do
+    grub_process_install_options "$@"
+    case "$grub_process_install_options_consumed" in
+       1) shift; continue;;
+       2) shift; shift; continue;;
+    esac
+
     option=$1
     shift
 
@@ -167,27 +161,7 @@ else
 fi
 
 memdisk_dir="`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
-mkdir -p "${memdisk_dir}"/boot/grub/"${grub_modinfo_target_cpu}-${grub_modinfo_platform}"
-
-for file in "${source_directory}/"*.mod "${source_directory}/"efiemu32.o "${source_directory}/"efiemu64.o; do
-    if test -f "$file"; then
-        cp -f "$file" "${memdisk_dir}"/boot/grub/"${grub_modinfo_target_cpu}-${grub_modinfo_platform}"
-    fi
-done
-
-for file in ${pkglib_DATA}; do
-    if test -f "${source_directory}/${file}"; then
-        cp -f "${source_directory}/${file}" "${memdisk_dir}"/boot/grub/"${grub_modinfo_target_cpu}-${grub_modinfo_platform}"
-    fi
-done
-
-mkdir -p "${memdisk_dir}"/boot/grub/locale
-for file in "${source_directory}"/po/*.mo; do
-    if test -f "$file"; then
-       cp -f "$file" "${memdisk_dir}"/boot/grub/locale/
-    fi
-done
-
+grub_install_files "${source_directory}" "${memdisk_dir}"/boot/grub "${grub_modinfo_target_cpu}-${grub_modinfo_platform}"
 for file in $source; do
     cp -f "$file" "${memdisk_dir}"/"$file";
 done