Use grub-probe and not cmp to check that disk is empty.

* util/grub-install.in: Use grub-probe for zero-check.
	* util/grub-probe.c (PRINT_ZERO_CHECK): New enum value.
	(probe): Handle PRINT_ZERO_CHECK.
	(argp_parser): Handle -t zero_check.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-05-11 21:07:39 +02:00
parent f1a6254cf1
commit fe8c2f1117
3 changed files with 53 additions and 2 deletions

View file

@ -776,7 +776,7 @@ elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ]
exit 1
fi
if [ "$(file -s "${install_device}" -b | awk '{ print $1 }')" = ELF ] || [ $(cmp /dev/zero "${install_device}" &>/dev/null) ]; then
if [ "$(file -s "${install_device}" -b | awk '{ print $1 }')" = ELF ] || [ x$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t zero_check) = xtrue ]; then
# Change boot device to the harddisk root
boot_device="$ofpath"
dd if="${grubdir}/${grub_modinfo_target_cpu}-$grub_modinfo_platform/core.${imgext}" of="${install_device}" status=noxfer || {