Apply program name transformations at build-time rather than at

run-time.  Fixes Debian bug #696465.

* acinclude.m4 (grub_TRANSFORM): New macro.
* configure.ac: Create output variables with transformed names for
most programs.
* util/bash-completion.d/grub-completion.bash.in: Use
pre-transformed variables for program names.
* util/grub-install.in: Likewise.
* util/grub-kbdcomp.in: Likewise.
* util/grub-mkconfig.in: Likewise.
* util/grub-mkconfig_lib.in: Likewise.
* util/grub-mknetdir.in: Likewise.
* util/grub-mkrescue.in: Likewise.
* util/grub-mkstandalone.in: Likewise.
* util/grub-reboot.in: Likewise.
* util/grub-set-default.in: Likewise.
* util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
* tests/util/grub-shell-tester.in: Remove unused assignment.
* tests/util/grub-shell.in: Likewise.
* util/grub.d/00_header.in: Likewise.
This commit is contained in:
Colin Watson 2012-12-28 06:57:17 +00:00
parent 7024b3c0c2
commit fd49ceb35c
17 changed files with 76 additions and 55 deletions

View file

@ -1,3 +1,27 @@
2012-12-28 Colin Watson <cjwatson@ubuntu.com>
Apply program name transformations at build-time rather than at
run-time. Fixes Debian bug #696465.
* acinclude.m4 (grub_TRANSFORM): New macro.
* configure.ac: Create output variables with transformed names for
most programs.
* util/bash-completion.d/grub-completion.bash.in: Use
pre-transformed variables for program names.
* util/grub-install.in: Likewise.
* util/grub-kbdcomp.in: Likewise.
* util/grub-mkconfig.in: Likewise.
* util/grub-mkconfig_lib.in: Likewise.
* util/grub-mknetdir.in: Likewise.
* util/grub-mkrescue.in: Likewise.
* util/grub-mkstandalone.in: Likewise.
* util/grub-reboot.in: Likewise.
* util/grub-set-default.in: Likewise.
* util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
* tests/util/grub-shell-tester.in: Remove unused assignment.
* tests/util/grub-shell.in: Likewise.
* util/grub.d/00_header.in: Likewise.
2012-12-28 Colin Watson <cjwatson@ubuntu.com> 2012-12-28 Colin Watson <cjwatson@ubuntu.com>
Backport gnulib fixes for C11. Fixes Savannah bug #37738. Backport gnulib fixes for C11. Fixes Savannah bug #37738.

View file

@ -452,3 +452,9 @@ else
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
[fi] [fi]
]) ])
dnl Create an output variable with the transformed name of a GRUB utility
dnl program.
AC_DEFUN([grub_TRANSFORM],[dnl
AC_SUBST(AS_TR_SH([$1]), [`AS_ECHO([$1]) | sed "$program_transform_name"`])dnl
])

View file

@ -50,6 +50,22 @@ AC_CONFIG_HEADER([config-util.h])
# Program name transformations # Program name transformations
AC_ARG_PROGRAM AC_ARG_PROGRAM
grub_TRANSFORM([grub-bios-setup])
grub_TRANSFORM([grub-editenv])
grub_TRANSFORM([grub-install])
grub_TRANSFORM([grub-mkconfig])
grub_TRANSFORM([grub-mkfont])
grub_TRANSFORM([grub-mkimage])
grub_TRANSFORM([grub-mklayout])
grub_TRANSFORM([grub-mkpasswd-pbkdf2])
grub_TRANSFORM([grub-mkrelpath])
grub_TRANSFORM([grub-mkrescue])
grub_TRANSFORM([grub-probe])
grub_TRANSFORM([grub-reboot])
grub_TRANSFORM([grub-script-check])
grub_TRANSFORM([grub-set-default])
grub_TRANSFORM([grub-setup])
grub_TRANSFORM([grub-sparc64-setup])
# Optimization flag. Allow user to override. # Optimization flag. Allow user to override.
if test "x$TARGET_CFLAGS" = x; then if test "x$TARGET_CFLAGS" = x; then

View file

@ -18,8 +18,6 @@ set -e
# along with GRUB. If not, see <http://www.gnu.org/licenses/>. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables. # Initialize some variables.
transform="@program_transform_name@"
prefix="@prefix@" prefix="@prefix@"
exec_prefix="@exec_prefix@" exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@" datarootdir="@datarootdir@"

View file

@ -18,8 +18,6 @@ set -e
# along with GRUB. If not, see <http://www.gnu.org/licenses/>. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables. # Initialize some variables.
transform="@program_transform_name@"
prefix="@prefix@" prefix="@prefix@"
exec_prefix="@exec_prefix@" exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@" datarootdir="@datarootdir@"

View file

@ -165,12 +165,12 @@ _grub_set_entry () {
fi fi
} }
__grub_set_default_program=$( echo grub-set-default | sed "@program_transform_name@" ) __grub_set_default_program="@grub_set_default@"
have ${__grub_set_default_program} && \ have ${__grub_set_default_program} && \
complete -F _grub_set_entry -o filenames ${__grub_set_default_program} complete -F _grub_set_entry -o filenames ${__grub_set_default_program}
unset __grub_set_default_program unset __grub_set_default_program
__grub_reboot_program=$( echo grub-reboot | sed "@program_transform_name@" ) __grub_reboot_program="@grub_reboot@"
have ${__grub_reboot_program} && \ have ${__grub_reboot_program} && \
complete -F _grub_set_entry -o filenames ${__grub_reboot_program} complete -F _grub_set_entry -o filenames ${__grub_reboot_program}
unset __grub_reboot_program unset __grub_reboot_program
@ -197,7 +197,7 @@ _grub_editenv () {
create list set unset" create list set unset"
} }
__grub_editenv_program=$( echo grub-editenv | sed "@program_transform_name@" ) __grub_editenv_program="@grub_editenv@"
have ${__grub_editenv_program} && \ have ${__grub_editenv_program} && \
complete -F _grub_editenv -o filenames ${__grub_editenv_program} complete -F _grub_editenv -o filenames ${__grub_editenv_program}
unset __grub_editenv_program unset __grub_editenv_program
@ -218,7 +218,7 @@ _grub_mkconfig () {
_filedir _filedir
fi fi
} }
__grub_mkconfig_program=$( echo grub-mkconfig | sed "@program_transform_name@" ) __grub_mkconfig_program="@grub_mkconfig@"
have ${__grub_mkconfig_program} && \ have ${__grub_mkconfig_program} && \
complete -F _grub_mkconfig -o filenames ${__grub_mkconfig_program} complete -F _grub_mkconfig -o filenames ${__grub_mkconfig_program}
unset __grub_mkconfig_program unset __grub_mkconfig_program
@ -252,7 +252,7 @@ _grub_setup () {
_filedir _filedir
fi fi
} }
__grub_setup_program=$( echo grub-setup | sed "@program_transform_name@" ) __grub_setup_program="@grub_setup@"
have ${__grub_setup_program} && \ have ${__grub_setup_program} && \
complete -F _grub_setup -o filenames ${__grub_setup_program} complete -F _grub_setup -o filenames ${__grub_setup_program}
unset __grub_setup_program unset __grub_setup_program
@ -298,7 +298,7 @@ _grub_install () {
_filedir _filedir
fi fi
} }
__grub_install_program=$( echo grub-install | sed "@program_transform_name@" ) __grub_install_program="@grub_install@"
have ${__grub_install_program} && \ have ${__grub_install_program} && \
complete -F _grub_install -o filenames ${__grub_install_program} complete -F _grub_install -o filenames ${__grub_install_program}
unset __grub_install_program unset __grub_install_program
@ -320,7 +320,7 @@ _grub_mkfont () {
_filedir _filedir
fi fi
} }
__grub_mkfont_program=$( echo grub-mkfont | sed "@program_transform_name@" ) __grub_mkfont_program="@grub_mkfont@"
have ${__grub_mkfont_program} && \ have ${__grub_mkfont_program} && \
complete -F _grub_mkfont -o filenames ${__grub_mkfont_program} complete -F _grub_mkfont -o filenames ${__grub_mkfont_program}
unset __grub_mkfont_program unset __grub_mkfont_program
@ -351,7 +351,7 @@ _grub_mkrescue () {
_filedir _filedir
fi fi
} }
__grub_mkrescue_program=$( echo grub-mkrescue | sed "@program_transform_name@" ) __grub_mkrescue_program="@grub_mkrescue@"
have ${__grub_mkrescue_program} && \ have ${__grub_mkrescue_program} && \
complete -F _grub_mkrescue -o filenames ${__grub_mkrescue_program} complete -F _grub_mkrescue -o filenames ${__grub_mkrescue_program}
unset __grub_mkrescue_program unset __grub_mkrescue_program
@ -393,7 +393,7 @@ _grub_mkimage () {
_filedir _filedir
fi fi
} }
__grub_mkimage_program=$( echo grub-mkimage | sed "@program_transform_name@" ) __grub_mkimage_program="@grub_mkimage@"
have ${__grub_mkimage_program} && \ have ${__grub_mkimage_program} && \
complete -F _grub_mkimage -o filenames ${__grub_mkimage_program} complete -F _grub_mkimage -o filenames ${__grub_mkimage_program}
unset __grub_mkimage_program unset __grub_mkimage_program
@ -415,7 +415,7 @@ _grub_mkpasswd_pbkdf2 () {
_filedir _filedir
fi fi
} }
__grub_mkpasswd_pbkdf2_program=$( echo grub-mkpasswd-pbkdf2 | sed "@program_transform_name@" ) __grub_mkpasswd_pbkdf2_program="@grub_mkpasswd_pbkdf2@"
have ${__grub_mkpasswd_pbkdf2_program} && \ have ${__grub_mkpasswd_pbkdf2_program} && \
complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program} complete -F _grub_mkpasswd_pbkdf2 -o filenames ${__grub_mkpasswd_pbkdf2_program}
unset __grub_mkpasswd_pbkdf2_program unset __grub_mkpasswd_pbkdf2_program
@ -453,7 +453,7 @@ _grub_probe () {
_filedir _filedir
fi fi
} }
__grub_probe_program=$( echo grub-probe | sed "@program_transform_name@" ) __grub_probe_program="@grub_probe@"
have ${__grub_probe_program} && \ have ${__grub_probe_program} && \
complete -F _grub_probe -o filenames ${__grub_probe_program} complete -F _grub_probe -o filenames ${__grub_probe_program}
unset __grub_probe_program unset __grub_probe_program
@ -475,7 +475,7 @@ _grub_script_check () {
_filedir _filedir
fi fi
} }
__grub_script_check_program=$( echo grub-script-check | sed "@program_transform_name@" ) __grub_script_check_program="@grub_script_check@"
have ${__grub_script_check_program} && \ have ${__grub_script_check_program} && \
complete -F _grub_script_check -o filenames ${__grub_script_check_program} complete -F _grub_script_check -o filenames ${__grub_script_check_program}

View file

@ -17,8 +17,6 @@
# along with GRUB. If not, see <http://www.gnu.org/licenses/>. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables. # Initialize some variables.
transform="@program_transform_name@"
prefix="@prefix@" prefix="@prefix@"
exec_prefix="@exec_prefix@" exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@" datarootdir="@datarootdir@"
@ -44,10 +42,10 @@ localedir="@datadir@/locale"
self="`basename $0`" self="`basename $0`"
grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`" grub_mkimage="${bindir}/@grub_mkimage@"
grub_probe="${sbindir}/`echo grub-probe | sed ${transform}`" grub_probe="${sbindir}/@grub_probe@"
grub_editenv="${bindir}/`echo grub-editenv | sed ${transform}`" grub_editenv="${bindir}/@grub_editenv@"
grub_mkrelpath="${bindir}/`echo grub-mkrelpath | sed ${transform}`" grub_mkrelpath="${bindir}/@grub_mkrelpath@"
rootdir= rootdir=
bootdir= bootdir=
grubdir="`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`" grubdir="`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`"
@ -347,11 +345,11 @@ else
fi fi
if test "x$grub_setup" = x && [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ]; then if test "x$grub_setup" = x && [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ]; then
grub_setup="${sbindir}/`echo grub-bios-setup | sed ${transform}`" grub_setup="${sbindir}/@grub_bios_setup@"
fi fi
if test "x$grub_setup" = x && [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "sparc64-ieee1275" ]; then if test "x$grub_setup" = x && [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "sparc64-ieee1275" ]; then
grub_setup="${sbindir}/`echo grub-sparc64-setup | sed ${transform}`" grub_setup="${sbindir}/@grub_sparc64_setup@"
fi fi
if test "x$install_device" = x && ([ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ] \ if test "x$install_device" = x && ([ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-pc" ] \

View file

@ -1,7 +1,5 @@
#!/bin/sh #!/bin/sh
transform="@program_transform_name@"
prefix="@prefix@" prefix="@prefix@"
exec_prefix="@exec_prefix@" exec_prefix="@exec_prefix@"
bindir="@bindir@" bindir="@bindir@"
@ -11,7 +9,7 @@ if [ "x$pkgdatadir" = x ]; then
pkgdatadir="${datadir}/@PACKAGE@" pkgdatadir="${datadir}/@PACKAGE@"
fi fi
grub_mklayout="${bindir}/`echo grub-mklayout | sed ${transform}`" grub_mklayout="${bindir}/@grub_mklayout@"
ckbcomp_options="" ckbcomp_options=""

View file

@ -17,7 +17,6 @@ set -e
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
transform="@program_transform_name@"
prefix="@prefix@" prefix="@prefix@"
exec_prefix="@exec_prefix@" exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@" datarootdir="@datarootdir@"
@ -39,9 +38,9 @@ grub_mkconfig_dir="${sysconfdir}"/grub.d
self=`basename $0` self=`basename $0`
grub_probe="${sbindir}/`echo grub-probe | sed "${transform}"`" grub_probe="${sbindir}/@grub_probe@"
grub_editenv="${bindir}/`echo grub-editenv | sed "${transform}"`" grub_editenv="${bindir}/@grub_editenv@"
grub_script_check="${bindir}/`echo grub-script-check | sed "${transform}"`" grub_script_check="${bindir}/@grub_script_check@"
export TEXTDOMAIN=@PACKAGE@ export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@" export TEXTDOMAINDIR="@localedir@"

View file

@ -14,8 +14,6 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
transform="@program_transform_name@"
prefix="@prefix@" prefix="@prefix@"
exec_prefix="@exec_prefix@" exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@" datarootdir="@datarootdir@"
@ -25,10 +23,10 @@ sbindir="@sbindir@"
pkgdatadir="${datadir}/@PACKAGE@" pkgdatadir="${datadir}/@PACKAGE@"
if test "x$grub_probe" = x; then if test "x$grub_probe" = x; then
grub_probe="${sbindir}/`echo grub-probe | sed "${transform}"`" grub_probe="${sbindir}/@grub_probe@"
fi fi
if test "x$grub_mkrelpath" = x; then if test "x$grub_mkrelpath" = x; then
grub_mkrelpath="${bindir}/`echo grub-mkrelpath | sed "${transform}"`" grub_mkrelpath="${bindir}/@grub_mkrelpath@"
fi fi
if which gettext >/dev/null 2>/dev/null; then if which gettext >/dev/null 2>/dev/null; then

View file

@ -17,8 +17,6 @@
# along with GRUB. If not, see <http://www.gnu.org/licenses/>. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables. # Initialize some variables.
transform="@program_transform_name@"
prefix="@prefix@" prefix="@prefix@"
exec_prefix="@exec_prefix@" exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@" datarootdir="@datarootdir@"
@ -36,7 +34,7 @@ fi
self=`basename $0` self=`basename $0`
grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`" grub_mkimage="${bindir}/@grub_mkimage@"
rootdir=/srv/tftp rootdir=/srv/tftp
modules= modules=

View file

@ -19,8 +19,6 @@ set -e
# Initialize some variables. # Initialize some variables.
transform="@program_transform_name@"
prefix="@prefix@" prefix="@prefix@"
exec_prefix="@exec_prefix@" exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@" datarootdir="@datarootdir@"
@ -49,7 +47,7 @@ efi64_dir="${libdir}/@PACKAGE@/x86_64-efi"
ia64_dir="${libdir}/@PACKAGE@/ia64-efi" ia64_dir="${libdir}/@PACKAGE@/ia64-efi"
rom_directory= rom_directory=
override_dir= override_dir=
grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`" grub_mkimage="${bindir}/@grub_mkimage@"
xorriso=xorriso xorriso=xorriso

View file

@ -19,8 +19,6 @@ set -e
# Initialize some variables. # Initialize some variables.
transform="@program_transform_name@"
prefix="@prefix@" prefix="@prefix@"
exec_prefix="@exec_prefix@" exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@" datarootdir="@datarootdir@"
@ -40,7 +38,7 @@ self=`basename $0`
source_directory= source_directory=
compression=auto compression=auto
format= format=
grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`" grub_mkimage="${bindir}/@grub_mkimage@"
source= source=
export TEXTDOMAIN=@PACKAGE@ export TEXTDOMAIN=@PACKAGE@

View file

@ -17,8 +17,6 @@
# along with GRUB. If not, see <http://www.gnu.org/licenses/>. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables. # Initialize some variables.
transform="@program_transform_name@"
prefix=@prefix@ prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
bindir=@bindir@ bindir=@bindir@
@ -32,7 +30,7 @@ fi
self=`basename $0` self=`basename $0`
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}` grub_editenv=${bindir}/@grub_editenv@
rootdir= rootdir=
bootdir= bootdir=
grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'` grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`

View file

@ -17,8 +17,6 @@
# along with GRUB. If not, see <http://www.gnu.org/licenses/>. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables. # Initialize some variables.
transform="@program_transform_name@"
prefix=@prefix@ prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
bindir=@bindir@ bindir=@bindir@
@ -32,7 +30,7 @@ fi
self=`basename $0` self=`basename $0`
grub_editenv=${bindir}/`echo grub-editenv | sed ${transform}` grub_editenv=${bindir}/@grub_editenv@
rootdir= rootdir=
bootdir= bootdir=
grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'` grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'`

View file

@ -17,8 +17,6 @@ set -e
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
transform="@program_transform_name@"
prefix="@prefix@" prefix="@prefix@"
exec_prefix="@exec_prefix@" exec_prefix="@exec_prefix@"
datarootdir="@datarootdir@" datarootdir="@datarootdir@"

View file

@ -18,8 +18,6 @@ set -e
# along with GRUB. If not, see <http://www.gnu.org/licenses/>. # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables. # Initialize some variables.
transform="@program_transform_name@"
prefix="@prefix@" prefix="@prefix@"
exec_prefix="@exec_prefix@" exec_prefix="@exec_prefix@"
bindir="@bindir@" bindir="@bindir@"
@ -36,7 +34,7 @@ fi
self=`basename $0` self=`basename $0`
grub_mkimage="${bindir}/`echo grub-mkimage | sed ${transform}`" grub_mkimage="${bindir}/@grub_mkimage@"
export TEXTDOMAIN=@PACKAGE@ export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@" export TEXTDOMAINDIR="@localedir@"