From a32d5c712d1680e81d4d14bd7b07bf9b4875cf8c Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 3 Feb 2012 11:42:22 +0100 Subject: [PATCH] * util/grub-mkstandalone.in: Fix help messages. Gettextize. * util/grub-install.in: Gettextize. * util/grub-mkconfig.in: Likewise. * util/grub-mkconfig_lib.in: Replace gettext with echo -n and not echo if not available. (grub_warn): Gettextize. * util/grub-mknetdir.in: Gettextize. * util/grub-mkrescue.in: Likewise. * util/grub-mkstandalone.in: Likewise. * util/grub-reboot.in: Likewise. * util/grub-set-default.in: Likewise. * util/grub.d/00_header.in: Likewise. * util/grub.d/10_hurd.in: Likewise. * util/grub.d/10_kfreebsd.in: Likewise. * util/grub.d/10_linux.in: Likewise. * util/grub.d/10_netbsd.in: Likewise. * util/grub.d/10_windows.in: Likewise. * util/grub.d/20_linux_xen.in: Likewise. * util/grub.d/30_os-prober.in: Likewise. * po/POTFILES-shell.in: Regenerate. --- ChangeLog | 23 ++++++++++ po/POTFILES-shell.in | 18 +++++++- util/grub-install.in | 86 ++++++++++++++++--------------------- util/grub-mkconfig.in | 48 +++++++++++---------- util/grub-mkconfig_lib.in | 10 +++-- util/grub-mknetdir.in | 41 +++++++++--------- util/grub-mkrescue.in | 52 +++++++++++----------- util/grub-mkstandalone.in | 52 ++++++++++++---------- util/grub-reboot.in | 37 ++++++++-------- util/grub-set-default.in | 37 ++++++++-------- util/grub.d/00_header.in | 11 ++--- util/grub.d/10_hurd.in | 9 ++-- util/grub.d/10_kfreebsd.in | 4 +- util/grub.d/10_linux.in | 4 +- util/grub.d/10_netbsd.in | 2 +- util/grub.d/10_windows.in | 6 +-- util/grub.d/20_linux_xen.in | 4 +- util/grub.d/30_os-prober.in | 25 ++++++++--- 18 files changed, 265 insertions(+), 204 deletions(-) diff --git a/ChangeLog b/ChangeLog index 60a2cbaf4..a62dc564a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2012-02-03 Vladimir Serbinenko + + * util/grub-mkstandalone.in: Fix help messages. Gettextize. + * util/grub-install.in: Gettextize. + * util/grub-mkconfig.in: Likewise. + * util/grub-mkconfig_lib.in: Replace gettext with echo -n and not echo + if not available. + (grub_warn): Gettextize. + * util/grub-mknetdir.in: Gettextize. + * util/grub-mkrescue.in: Likewise. + * util/grub-mkstandalone.in: Likewise. + * util/grub-reboot.in: Likewise. + * util/grub-set-default.in: Likewise. + * util/grub.d/00_header.in: Likewise. + * util/grub.d/10_hurd.in: Likewise. + * util/grub.d/10_kfreebsd.in: Likewise. + * util/grub.d/10_linux.in: Likewise. + * util/grub.d/10_netbsd.in: Likewise. + * util/grub.d/10_windows.in: Likewise. + * util/grub.d/20_linux_xen.in: Likewise. + * util/grub.d/30_os-prober.in: Likewise. + * po/POTFILES-shell.in: Regenerate. + 2012-02-03 Richard Laager * util/grub-mkimage.c (main): Fix format-security warning. diff --git a/po/POTFILES-shell.in b/po/POTFILES-shell.in index 70c2a3fd4..46c589f03 100644 --- a/po/POTFILES-shell.in +++ b/po/POTFILES-shell.in @@ -1,7 +1,21 @@ -# List of files which contain translatable strings. Only files written in -# Shell language are included here. +util/grub.d/00_header.in util/grub.d/10_hurd.in +util/grub.d/10_illumos.in util/grub.d/10_kfreebsd.in util/grub.d/10_linux.in util/grub.d/10_netbsd.in +util/grub.d/10_windows.in util/grub.d/20_linux_xen.in +util/grub.d/30_os-prober.in +util/grub.d/40_custom.in +util/grub.d/41_custom.in +util/grub-install.in +util/grub-kbdcomp.in +util/grub-mkconfig.in +util/grub-mkconfig_lib.in +util/grub-mknetdir.in +util/grub-mkrescue.in +util/grub-mkstandalone.in +util/grub-reboot.in +util/grub-set-default.in +util/powerpc/ieee1275/grub-mkrescue.in diff --git a/util/grub-install.in b/util/grub-install.in index 9d219bb93..2cec0c4ca 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -79,63 +79,53 @@ else disk_module=native fi +. "${datadir}/@PACKAGE@/grub-mkconfig_lib" + # Usage: usage # Print the usage. usage () { -if [ "${target_cpu}-${platform}" = "i386-pc" ] \ - || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ]; then - cat <. -EOF +gettext_printf "%s copies GRUB images into %s, and uses grub-setup +to install grub into the boot sector.\n" "$self" "$grubdir";echo +echo +gettext "Report bugs to ."; echo } argument () { @@ -265,8 +255,6 @@ do esac done -. "${datadir}/@PACKAGE@/grub-mkconfig_lib" - if test "x$install_device" = x && ([ "${target_cpu}-${platform}" = "i386-pc" ] \ || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ]); then echo "install_device not specified." 1>&2 diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index c7175586d..c876a4e4c 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -42,19 +42,19 @@ grub_script_check="${bindir}/`echo grub-script-check | sed "${transform}"`" GRUB_PREFIX=`echo '/@bootdirname@/@grubdirname@' | sed "s,//*,/,g"` +. "${datadir}/@PACKAGE@/grub-mkconfig_lib" + # Usage: usage # Print the usage. usage () { - cat <. -EOF + gettext_printf "Usage: %s [OPTION]\n" "$self" + gettext "Generate a grub config file"; echo + echo + printf " -o, --output=%-11s%s\n" "$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")" + printf " -h, --help %s\n" "$(gettext "print this message and exit")" + printf " -v, --version %s\n" "$(gettext "print the version information and exit")" + echo + gettext "Report bugs to ."; echo } argument () { @@ -62,7 +62,7 @@ argument () { shift if test $# -eq 0; then - echo "$0: option requires an argument -- '$opt'" 1>&2 + gettext_printf "%s: option requires an argument -- '%s'" "$0" "$opt" 1>&2 exit 1 fi echo $1 @@ -87,7 +87,7 @@ do grub_cfg=`echo "$option" | sed 's/--output=//'` ;; -*) - echo "Unrecognized option \`$option'" 1>&2 + gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2 usage exit 1 ;; @@ -113,7 +113,7 @@ if [ "$EUID" != 0 ] ; then done ;; esac if [ $root != t ] ; then - echo "$self: You must run this as root" >&2 + gettext_printf "%s: You must run this as root\n" "$self" >&2 exit 1 fi fi @@ -122,7 +122,7 @@ set $grub_probe dummy if test -f "$1"; then : else - echo "$1: Not found." 1>&2 + gettext_print "%s: Not found.\n" "$1" 1>&2 exit 1 fi @@ -184,7 +184,7 @@ for x in ${GRUB_TERMINAL_OUTPUT}; do fi if [ -z "${GRUB_FONT_PATH}" ] ; then if [ "x$termoutdefault" != "x1" ]; then - echo "No font for gfxterm found." >&2 ; exit 1 + gettext "No font for gfxterm found." >&2; echo >&2 ; exit 1 fi GRUB_TERMINAL_OUTPUT= fi @@ -253,10 +253,11 @@ if test "x${grub_cfg}" != "x"; then # Allow this to fail, since /boot/grub/ might need to be fatfs to support some # firmware implementations (e.g. OFW or EFI). - chmod 400 ${grub_cfg}.new || grub_warn "Could not make ${grub_cfg}.new readable by only root.\ - This means that if the generated config contains a password it is readable by everyone" + chmod 400 ${grub_cfg}.new || grub_warn "$(gettext_printf "Could not make %s \ +readable by only root. This means that if the generated config contains a password it is readable by everyone" "${grub_cfg}.new")" fi -echo "Generating grub.cfg ..." >&2 +gettext "Generating grub.cfg ..." >&2 +echo >&2 cat << EOF # @@ -286,14 +287,15 @@ done if test "x${grub_cfg}" != "x" ; then if ! ${grub_script_check} ${grub_cfg}.new; then - echo "Syntax errors are detected in generated GRUB config file." >&2 - echo "Ensure that there are no errors in /etc/default/grub" >&2 - echo "and /etc/grub.d/* files or please file a bug report with" >&2 - echo "${grub_cfg}.new file attached." >&2 + gettext_printf "Syntax errors are detected in generated GRUB config file. +Ensure that there are no errors in /etc/default/grub +and /etc/grub.d/* files or please file a bug report with +%s file attached." "${grub_cfg}.new" >&2 else # none of the children aborted with error, install the new grub.cfg mv -f ${grub_cfg}.new ${grub_cfg} fi fi -echo "done" >&2 +gettext "done" >&2 +echo >&2 diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in index 0b77dc38c..c1573379c 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -32,14 +32,16 @@ if test "x$grub_mkrelpath" = x; then fi if $(which gettext >/dev/null 2>/dev/null) ; then - gettext="gettext" + : else - gettext="echo" + gettext () { + echo -n "$@" + } fi grub_warn () { - echo "Warning: $@" >&2 + echo "$(gettext "Warning:")" "$@" >&2 } make_system_path_relative_to_its_root () @@ -228,7 +230,7 @@ version_find_latest () # printf; so this turns ' into \'. Note that you must use the output of # this function in a printf format string. gettext_quoted () { - "$gettext" "$@" | sed "s/'/'\\\\\\\\''/g" + gettext "$@" | sed "s/'/'\\\\\\\\''/g" } # Run the first argument through gettext_quoted, and then pass that and all diff --git a/util/grub-mknetdir.in b/util/grub-mknetdir.in index 4f4061621..e93db7ff9 100644 --- a/util/grub-mknetdir.in +++ b/util/grub-mknetdir.in @@ -29,6 +29,7 @@ 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@" self=`basename $0` @@ -51,24 +52,24 @@ efi32_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/i386-efi" efi64_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/x86_64-efi" itanium_dir="${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/ia64-efi" +. "${datadir}/@PACKAGE@/grub-mkconfig_lib" + # Usage: usage # Print the usage. usage () { - cat <. -EOF + gettext_printf "Usage: %s [OPTION] install_device\n" "$self" + gettext; echo "Install GRUB on your drive."; echo + echo + printf " -h, --help %s\n" "$(gettext "print this message and exit")" + printf " -v, --version %s\n" "$(gettext "print the version information and exit")" + printf " --modules=%-14s%s\n" "$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")" + printf " --net-directory=%-8s%s\n" "$(gettext "DIR")" "$(gettext "root directory of TFTP server")" + printf " --subdir=%-15s%s\n" "$(gettext "DIR")" "$(gettext "relative subdirectory on network server")" + printf " --grub-mkimage=%-9s%s" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")" + echo + gettext_printf "%s copies GRUB images into net_directory/subdir/target_cpu-platform\n" "$self" + echo + gettext "Report bugs to ."; echo } argument () { @@ -76,7 +77,7 @@ argument () { shift if test $# -eq 0; then - echo "$0: option requires an argument -- '$opt'" 1>&2 + gettext_printf "%s: option requires an argument -- '%s'\n" "$0" "$opt" 1>&2 exit 1 fi echo $1 @@ -138,7 +139,7 @@ do ;; -*) - echo "Unrecognized option \`$option'" 1>&2 + gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2 usage exit 1 ;; @@ -156,7 +157,7 @@ set $grub_mkimage dummy if test -f "$1"; then : else - echo "$1: Not found." 1>&2 + gettext_printf "%s: Not found.\n" "$1" 1>&2 exit 1 fi @@ -215,7 +216,7 @@ process_input_dir () *-efi) mkimage_target="${platform}"; netmodules="efinet"; ext=efi ;; - *) echo Unsupported platform ${platform}; + *) gettext_printf "Unsupported platform %s\n" ${platform}; exit 1;; esac @@ -224,7 +225,7 @@ source ${subdir}/grub.cfg EOF "$grub_mkimage" ${config_opt} -d "${input_dir}" -O ${mkimage_target} "--output=${grubdir}/core.$ext" "--prefix=$prefix" $modules $netmodules tftp || exit 1 - echo "Netboot directory for ${platform} created. Configure your DHCP server to point to ${subdir}/${platform}/core.$ext" + gettext_printf "Netboot directory for %s created. Configure your DHCP server to point to %s\n" "${platform}" "${subdir}/${platform}/core.$ext" } if [ "${override_dir}" = "" ] ; then diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index ccad5e0d9..9c0e9085f 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -29,6 +29,7 @@ libdir="@libdir@" PACKAGE_NAME=@PACKAGE_NAME@ PACKAGE_TARNAME=@PACKAGE_TARNAME@ PACKAGE_VERSION=@PACKAGE_VERSION@ +datadir="@datadir@" pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst" self=`basename $0` @@ -45,29 +46,29 @@ grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`" xorriso=xorriso +. "${datadir}/@PACKAGE@/grub-mkconfig_lib" + # Usage: usage # Print the usage. usage () { - cat <. -Mail xorriso support requests to . -EOF + gettext_printf "Usage: %s [OPTION] SOURCE...\n" "$self" + gettext "Make GRUB rescue image."; echo + echo + printf " -h, --help %s\n" "$(gettext "print this message and exit")" + printf " -v, --version %s\n" "$(gettext "print the version information and exit")" + printf " -o, --output=%-11s%s\n" "$(gettext FILE)" "$(gettext "save output in FILE [required]")" + printf " --modules=%-14s%s\n" "$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")" + printf " --rom-directory=%-8s%s\n" "$(gettext "DIR")" "$(gettext "save rom images in DIR [optional]")" + printf " --xorriso=%-14s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as xorriso [optional]")" + printf " --grub-mkimage=%-9s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")" + echo + gettext_printf "%s generates a bootable rescue image with specified source files, source +directories, or mkisofs options listed by: xorriso -as mkisofs -help" "$self" + echo + gettext "Option -- switches to native xorriso command mode."; echo + echo + gettext "Report bugs to ."; echo + gettext "Mail xorriso support requests to ."; echo } argument () { @@ -75,7 +76,7 @@ argument () { shift if test $# -eq 0; then - echo "$0: option requires an argument -- '$opt'" 1>&2 + gettext_printf "%s: option requires an argument -- '%s'\n" "$0" "$opt" 1>&2 exit 1 fi echo $1 @@ -139,7 +140,8 @@ do done if [ "x${output_image}" = x ] ; then - echo "output file must be given" >&2 + gettext "output file must be given" >&2 + echo >&2 usage exit 1 fi @@ -148,7 +150,7 @@ set $grub_mkimage dummy if test -f "$1"; then : else - echo "$1: Not found." 1>&2 + gettext_printf "%s: Not found.\n" "$1" 1>&2 exit 1 fi @@ -187,7 +189,7 @@ make_image () return; fi - echo "Enabling $2 support ..." + gettext_printf "Enabling %s support ...\n" "$2" memdisk_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 memdisk_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 @@ -255,7 +257,7 @@ grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${i # build BIOS core.img if test -e "${pc_dir}" ; then - echo "Enabling BIOS support ..." + gettext_printf "Enabling %s support ...\n" "BIOS" core_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 $grub_mkimage -O i386-pc -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \ iso9660 biosdisk diff --git a/util/grub-mkstandalone.in b/util/grub-mkstandalone.in index 13cf9df7b..3cb3eb30c 100644 --- a/util/grub-mkstandalone.in +++ b/util/grub-mkstandalone.in @@ -2,7 +2,7 @@ set -e # Make GRUB rescue image -# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. +# 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 @@ -30,6 +30,7 @@ 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@" self=`basename $0` @@ -39,27 +40,31 @@ format= grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`" source= +. "${datadir}/@PACKAGE@/grub-mkconfig_lib" + # Usage: usage # Print the usage. usage () { - cat <. -EOF + formats="i386-coreboot i386-multiboot i386-pc i386-pc-pxe i386-efi i386-ieee1275 i386-qemu x86_64-efi mipsel-yeeloong-flash mipsel-fuloong2f-flash mipsel-loongson-elf powerpc-ieee1275 sparc64-ieee1275-raw sparc64-ieee1275-aout ia64-efi mips-arc mipsel-qemu_mips-elf mips-qemu_mips-flash mipsel-qemu_mips-flash mips-qemu_mips-elf" + gettext_printf "Usage: %s [OPTION] SOURCE...\n" "$self" + gettext "Make GRUB rescue image."; echo + echo + printf " -h, --help %s\n" "$(gettext "print this message and exit")" + printf " -v, --version %s\n" "$(gettext "print the version information and exit")" + printf " -o, --output=%-11s%s\n" "$(gettext FILE)" "$(gettext "save output in FILE [required]")" + dir_msg="$(gettext_printf "use images and modules under DIR [default=%s/]" "${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})")" + printf " -d, --directory=%-8s%s\n" \ + "DIR" "$dir_msg" + printf " -O, --format=%-11s%s" "$(gettext "FORMAT")" "$(gettext "generate an image in format")"; echo + printf " %s %s\n" "$(gettext "available formats:")" "$formats" + echo + printf " -C, --compression=(xz|none|auto) %s\n" "$(gettext "choose the compression to use")" + printf " --modules=%-14s%s\n" "$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")" + printf " --grub-mkimage=%-9s%s\n" "$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")" + echo + gettext_printf "%s generates a standalone image (containing all modules) in the selected format" "$self" + echo + gettext "Report bugs to ."; echo } argument () { @@ -67,7 +72,7 @@ argument () { shift if test $# -eq 0; then - echo "$0: option requires an argument -- '$opt'" 1>&2 + gettext_printf "%s: option requires an argument -- '%s'\n" "$0" "$opt" 1>&2 exit 1 fi echo $1 @@ -123,14 +128,15 @@ do done if [ "x${output_image}" = x ] ; then - echo "output file must be given" >&2 + gettext "output file must be specified" >&2 + echo >&2 usage exit 1 fi if [ "x${format}" = x ] ; then - echo "format must be given" >&2 - usage + gettext "format must be specified" >&2 + echo >&2 exit 1 fi diff --git a/util/grub-reboot.in b/util/grub-reboot.in index 929cf5202..b003de10a 100644 --- a/util/grub-reboot.in +++ b/util/grub-reboot.in @@ -24,6 +24,7 @@ exec_prefix=@exec_prefix@ bindir=@bindir@ PACKAGE_NAME=@PACKAGE_NAME@ PACKAGE_VERSION=@PACKAGE_VERSION@ +datadir="@datadir@" self=`basename $0` @@ -32,22 +33,22 @@ rootdir= bootdir= grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'` +. "${datadir}/@PACKAGE@/grub-mkconfig_lib" + # Usage: usage # Print the usage. usage () { - cat <. -EOF + gettext_printf "Usage: %s [OPTION] entry" "$self" + gettext "Set the default boot entry for GRUB, for the next boot only."; echo + echo + printf " -h, --help %s\n" "$(gettext "print this message and exit")" + printf " -v, --version %s\n" "$(gettext "print the version information and exit")" + dirmsg="$(gettext_printf "expect GRUB images under the directory DIR/%s instead of the %s directory" "@grubdirname@" "$grubdir")" + printf " --boot-directory=%-7s%s\n" "$(gettext "DIR")" "$dirmsg" + echo + gettext "ENTRY is a number or a menu item title."; echo + echo + gettext "Report bugs to ."; echo } argument () { @@ -55,7 +56,7 @@ argument () { shift if test $# -eq 0; then - echo "$0: option requires an argument -- '$opt'" 1>&2 + gettext_printf "%s: option requires an argument -- '%s'\n" "$0" "$opt" 1>&2 exit 1 fi echo $1 @@ -87,13 +88,14 @@ do bootdir=`echo "$option" | sed 's/--boot-directory=//'` ;; -*) - echo "Unrecognized option \`$option'" 1>&2 + gettext_printf "Unrecognized option \`%s'" "$option" 1>&2 usage exit 1 ;; *) if test "x$entry" != x; then - echo "More than one entry?" 1>&2 + gettext "More than one entry?" 1>&2 + echo >&2 usage exit 1 fi @@ -102,7 +104,8 @@ do done if test "x$entry" = x; then - echo "entry not specified." 1>&2 + gettext "entry not specified." 1>&2 + echo >&2 usage exit 1 fi diff --git a/util/grub-set-default.in b/util/grub-set-default.in index b09727de2..100ae9921 100644 --- a/util/grub-set-default.in +++ b/util/grub-set-default.in @@ -24,6 +24,7 @@ exec_prefix=@exec_prefix@ bindir=@bindir@ PACKAGE_NAME=@PACKAGE_NAME@ PACKAGE_VERSION=@PACKAGE_VERSION@ +datadir="@datadir@" self=`basename $0` @@ -32,22 +33,22 @@ rootdir= bootdir= grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'` +. "${datadir}/@PACKAGE@/grub-mkconfig_lib" + # Usage: usage # Print the usage. usage () { - cat <. -EOF + gettext_printf "Usage: %s [OPTION] entry\n" "$self" + gettext "Set the default boot entry for GRUB."; echo + echo + printf " -h, --help %s\n" "$(gettext "print this message and exit")" + printf " -v, --version %s\n" "$(gettext "print the version information and exit")" + dirmsg="$(printf "expect GRUB images under the directory DIR/%s instead of the %s directory" "@grubdirname@" "$grubdir")" + printf " --boot-directory=%-7s%s\n" "$(gettext "DIR")" "$dirmsg" + echo + gettext "ENTRY is a number or a menu item title."; echo + echo + gettext "Report bugs to ."; echo } argument () { @@ -55,7 +56,7 @@ argument () { shift if test $# -eq 0; then - echo "$0: option requires an argument -- '$opt'" 1>&2 + gettext_printf "%s: option requires an argument -- '%s'\n" "$0" "$opt" 1>&2 exit 1 fi echo $1 @@ -87,13 +88,14 @@ do bootdir=`echo "$option" | sed 's/--boot-directory=//'` ;; -*) - echo "Unrecognized option \`$option'" 1>&2 + gettext_printf "Unrecognized option \`%s'" "$option" 1>&2 usage exit 1 ;; *) if test "x$entry" != x; then - echo "More than one entry?" 1>&2 + gettext "More than one entry?" 1>&2 + echo >&2 usage exit 1 fi @@ -102,7 +104,8 @@ do done if test "x$entry" = x; then - echo "entry not specified." 1>&2 + gettext "entry not specified." 1>&2 + echo >&2 usage exit 1 fi diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in index ece1b90da..d9bcc15bc 100644 --- a/util/grub.d/00_header.in +++ b/util/grub.d/00_header.in @@ -113,11 +113,11 @@ done if [ "x$serial" = x1 ]; then if ! test -e "${GRUB_PREFIX}/serial.mod" ; then - echo "Serial terminal not available on this platform." >&2 ; exit 1 + gettext "Serial terminal not available on this platform." >&2 ; echo >&2; exit 1 fi if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then - grub_warn "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used." + grub_warn "$(gettext "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used.")" GRUB_SERIAL_COMMAND=serial fi echo "${GRUB_SERIAL_COMMAND}" @@ -174,7 +174,8 @@ esac if [ "x$gfxterm" = x1 ]; then if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \ && is_path_readable_by_grub "$GRUB_THEME"; then - echo "Found theme: $GRUB_THEME" >&2 + gettext_printf "Found theme: %s\n" "$GRUB_THEME" >&2 + prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"` cat << EOF insmod gfxmenu @@ -208,12 +209,12 @@ set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME` EOF elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \ && is_path_readable_by_grub "$GRUB_BACKGROUND"; then - echo "Found background: $GRUB_BACKGROUND" >&2 + gettext_printf "Found background: %s\n" "$GRUB_BACKGROUND" >&2 case "$GRUB_BACKGROUND" in *.png) reader=png ;; *.tga) reader=tga ;; *.jpg|*.jpeg) reader=jpeg ;; - *) echo "Unsupported image format" >&2; exit 1 ;; + *) gettext "Unsupported image format" >&2; echo >&2; exit 1 ;; esac prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"` cat << EOF diff --git a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in index c885eaba6..23099f225 100644 --- a/util/grub.d/10_hurd.in +++ b/util/grub.d/10_hurd.in @@ -41,7 +41,8 @@ for i in /boot/gnumach* ; do basename=`basename $i` dirname=`dirname $i` rel_dirname=`make_system_path_relative_to_its_root $dirname` - echo "Found GNU Mach: $i" >&2 + gettext_printf "Found GNU Mach: %s" "$i" >&2 + echo >&2 kernels="${kernels} ${rel_dirname}/${basename}" at_least_one=true fi @@ -55,7 +56,8 @@ esac for i in /hurd/${hurd_fs}.static /hurd/exec ; do if test -e "$i" ; then - echo "Found Hurd module: $i" >&2 + gettext_printf "Found Hurd module: %s" "$i" >&2 + echo >&2 at_least_one=true else all_of_them=false @@ -68,7 +70,8 @@ if ${at_least_one} ; then : ; else fi if ${all_of_them} && test -e /lib/ld.so.1 ; then : ; else - echo "Some Hurd stuff found, but not enough to boot." >&2 + gettext "Some Hurd stuff found, but not enough to boot." >&2 + echo >&2 exit 1 fi diff --git a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in index dede4f6da..c31551206 100644 --- a/util/grub.d/10_kfreebsd.in +++ b/util/grub.d/10_kfreebsd.in @@ -135,7 +135,7 @@ prepare_boot_cache= while [ "x$list" != "x" ] ; do kfreebsd=`version_find_latest $list` - echo "Found kernel of FreeBSD: $kfreebsd" >&2 + gettext_printf "Found kernel of FreeBSD: %s\n" "$kfreebsd" >&2 basename=`basename $kfreebsd` dirname=`dirname $kfreebsd` rel_dirname=`make_system_path_relative_to_its_root $dirname` @@ -184,7 +184,7 @@ while [ "x$list" != "x" ] ; do fi done if test -n "${module_dir}" ; then - echo "Found kernel module directory: ${module_dir}" >&2 + gettext_printf "Found kernel module directory: %s\n" "${module_dir}" >&2 module_dir_rel=$(make_system_path_relative_to_its_root $module_dir) fi diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index d5586b375..bc738f205 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -146,7 +146,7 @@ prepare_root_cache= while [ "x$list" != "x" ] ; do linux=`version_find_latest $list` - echo "Found linux image: $linux" >&2 + gettext_printf "Found linux image: %s\n" "$linux" >&2 basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` @@ -181,7 +181,7 @@ while [ "x$list" != "x" ] ; do fi if test -n "${initrd}" ; then - echo "Found initrd image: ${dirname}/${initrd}" >&2 + gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 elif test -z "${initramfs}" ; then # "UUID=" magic is parsed by initrd or initramfs. Since there's # no initrd or builtin initramfs, it can't work here. diff --git a/util/grub.d/10_netbsd.in b/util/grub.d/10_netbsd.in index df095ddc0..236842da1 100644 --- a/util/grub.d/10_netbsd.in +++ b/util/grub.d/10_netbsd.in @@ -132,7 +132,7 @@ for k in $(ls -t /netbsd*) ; do continue fi - echo "Found NetBSD kernel: $k" >&2 + gettext_printf "Found NetBSD kernel: %s\n" "$k" >&2 netbsd_entry "knetbsd" "$k" false "${GRUB_CMDLINE_NETBSD_DEFAULT}" netbsd_entry "multiboot" "$k" false "${GRUB_CMDLINE_NETBSD_DEFAULT}" if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then diff --git a/util/grub.d/10_windows.in b/util/grub.d/10_windows.in index 8ee75d261..08a8c6afd 100644 --- a/util/grub.d/10_windows.in +++ b/util/grub.d/10_windows.in @@ -63,11 +63,11 @@ for drv in $drives ; do # Check for Vista bootmgr. if [ -f "$dir"/bootmgr -a -f "$dir"/boot/bcd ] ; then - OS="Windows Vista bootmgr" + OS="$(gettext_quoted "Windows Vista bootmgr")" # Check for NTLDR. elif [ -f "$dir"/ntldr -a -f "$dir"/ntdetect.com -a -f "$dir"/boot.ini ] ; then - OS=`get_os_name_from_boot_ini "$dir"/boot.ini` || OS="Windows NT/2000/XP loader" + OS=`get_os_name_from_boot_ini "$dir"/boot.ini` || OS="$(gettext_quoted "Windows NT/2000/XP loader")" needmap=t else @@ -77,7 +77,7 @@ for drv in $drives ; do # Get boot /dev/ice. dev=`${grub_probe} -t device "$dir" 2>/dev/null` || continue - echo "Found $OS on $drv ($dev)" >&2 + gettext_printf "Found %s on %s (%s)\n" "$OS" "$drv" "$dev" >&2 cat << EOF menuentry "$OS" { EOF diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in index ab6319feb..56771abca 100644 --- a/util/grub.d/20_linux_xen.in +++ b/util/grub.d/20_linux_xen.in @@ -142,7 +142,7 @@ while [ "x${xen_list}" != "x" ] ; do echo "submenu \"Xen ${xen_version}\" {" while [ "x$list" != "x" ] ; do linux=`version_find_latest $list` - echo "Found linux image: $linux" >&2 + gettext_printf "Found linux image: %s\n" "$linux" >&2 basename=`basename $linux` dirname=`dirname $linux` rel_dirname=`make_system_path_relative_to_its_root $dirname` @@ -162,7 +162,7 @@ while [ "x${xen_list}" != "x" ] ; do fi done if test -n "${initrd}" ; then - echo "Found initrd image: ${dirname}/${initrd}" >&2 + gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2 else # "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here. linux_root_device_thisversion=${GRUB_DEVICE} diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in index 5f4515240..0d8ea7fd6 100644 --- a/util/grub.d/30_os-prober.in +++ b/util/grub.d/30_os-prober.in @@ -39,8 +39,17 @@ if [ -z "${OSPROBED}" ] ; then fi osx_entry() { + if [ x$2 = x32 ]; then + # TRANSLATORS: it refers to kernel architecture (32-bit) + bitstr="$(gettext "(32-bit)")" + else + # TRANSLATORS: it refers to kernel architecture (32-bit) + bitstr="$(gettext "(64-bit)")" + fi + # TRANSLATORS: it refers on the OS residing on device %s + onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" --class osx --class darwin --class os { +menuentry "${LONGNAME} $bitstr $onstr" --class osx --class darwin --class os { EOF save_default_entry | sed -e "s/^/\t/" prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" @@ -99,13 +108,14 @@ for OS in ${OSPROBED} ; do LONGNAME="${LABEL}" fi - echo "Found ${LONGNAME} on ${DEVICE}" >&2 + gettext_printf "Found %s on %s\n" "${LONGNAME}" "${DEVICE}" >&2 case ${BOOT} in chain) + onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -menuentry "${LONGNAME} (on ${DEVICE})" --class windows --class os { +menuentry "${LONGNAME} $onstr" --class windows --class os { EOF save_default_entry | sed -e "s/^/\t/" prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" @@ -146,8 +156,9 @@ EOF LINITRD="${LINITRD#/boot}" fi + onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -menuentry "${LLABEL} (on ${DEVICE})" --class gnu-linux --class gnu --class os { +menuentry "${LLABEL} $onstr" --class gnu-linux --class gnu --class os { EOF save_default_entry | sed -e "s/^/\t/" if [ -z "${prepare_boot_cache}" ]; then @@ -173,8 +184,9 @@ EOF osx_entry xnu_kernel64 64 ;; hurd) + onstr="$(gettext_printf "(on %s)" "${DEVICE}")" cat << EOF -menuentry "${LONGNAME} (on ${DEVICE})" --class hurd --class gnu --class os { +menuentry "${LONGNAME} $onstr" --class hurd --class gnu --class os { EOF save_default_entry | sed -e "s/^/\t/" prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/" @@ -198,7 +210,8 @@ EOF EOF ;; *) - echo " ${LONGNAME} is not yet supported by grub-mkconfig." >&2 + echo -n " " + gettext_printf "%s is not yet supported by grub-mkconfig.\n" "${LONGNAME}" >&2 ;; esac done