grub/tests/grub_cmd_set_date.in
Vladimir Serbinenko a567ab3d9e Fix shebang for termux.
Termux doesn't have a /bin/sh. So we needto use $SHELL.
Keep /bin/sh as much as possible.
2020-09-21 11:32:45 -04:00

35 lines
771 B
Text

#! @BUILD_SHEBANG@
set -e
. "@builddir@/grub-core/modinfo.sh"
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
# FIXME: OpenBIOS on sparc64 doesn't implement RTC
sparc64-ieee1275)
exit 0;;
# PLATFORM: ARC doesn't provide any way to set time
*-arc)
exit 0;;
# PLATFORM: EMU doesn't provide any way to set time
# Even if it did we'd need some kind of sandbox to avoid
# modifying real system time.
*-emu)
exit 0;;
esac
out=$(cat <<EOF | @builddir@/grub-shell
insmod datehook
date
if [ \$YEAR = 2004 -a \$MONTH = 4 -a \$DAY = 4 -a \$HOUR = 20 -a \$MINUTE = 47 ]; then
hello
halt
fi
date 2004-04-04 20:47:00
reboot
EOF
)
if [ "$(echo "$out" | tail -n 1)" != "Hello World" ]; then
echo "Test failed: $out"
exit 1
fi