grub/tests/grub_cmd_date.in
Vladimir Serbinenko 5a0c548ba3 Remove bashisms from tests.
Those tests don't actually need bash. Just use common shebang.
2017-05-03 12:10:36 +02:00

29 lines
710 B
Bash

#! /bin/sh
set -e
. "@builddir@/grub-core/modinfo.sh"
# FIXME: OpenBIOS on sparc64 doesn't implement RTC
if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then
exit 0
fi
pdt="$(date -u +%s)"
dt=`echo date | @builddir@/grub-shell`
dtg="$(date -u -d "$dt" +%s)"
ndt="$(date -u +%s)"
if [ $pdt -gt $dtg ] || [ $dtg -gt $ndt ]; then
echo "Date not in range: $pdt <= $dtg <= $ndt"
exit 1
fi
pdt="$(date -u +%s)"
dt=`echo 'insmod datehook; echo $YEAR-$MONTH-$DAY $HOUR:$MINUTE:$SECOND' | @builddir@/grub-shell`
dtg="$(date -u -d "$dt" +%s)"
ndt="$(date -u +%s)"
if [ $pdt -gt $dtg ] || [ $dtg -gt $ndt ]; then
echo "Date not in range: $pdt <= $dtg <= $ndt"
exit 1
fi