diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:29:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:29:51 +0000 |
commit | 6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e (patch) | |
tree | 32451fa3cdd9321fb2591fada9891b2cb70a9cd1 /tests/grub_cmd_date.in | |
parent | Initial commit. (diff) | |
download | grub2-6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e.tar.xz grub2-6e7a315eb67cb6c113cf37e1d66c4f11a51a2b3e.zip |
Adding upstream version 2.06.upstream/2.06upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/grub_cmd_date.in')
-rw-r--r-- | tests/grub_cmd_date.in | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/grub_cmd_date.in b/tests/grub_cmd_date.in new file mode 100644 index 0000000..f7c9ca0 --- /dev/null +++ b/tests/grub_cmd_date.in @@ -0,0 +1,29 @@ +#! @BUILD_SHEBANG@ +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 | sed 's, [A-Z][a-z]*$,,'` +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 |