grub_cmd_date.in 744 B

123456789101112131415161718192021222324252627282930
  1. #! @BUILD_SHEBANG@
  2. set -e
  3. . "@builddir@/grub-core/modinfo.sh"
  4. # FIXME: OpenBIOS on sparc64 doesn't implement RTC
  5. if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = sparc64-ieee1275 ]; then
  6. exit 0
  7. fi
  8. pdt="$(date -u +%s)"
  9. dt=`echo date | @builddir@/grub-shell | sed 's, [A-Z][a-z]*$,,'`
  10. dtg="$(date -u -d "$dt" +%s)"
  11. ndt="$(date -u +%s)"
  12. if [ $pdt -gt $dtg ] || [ $dtg -gt $ndt ]; then
  13. echo "Date not in range: $pdt <= $dtg <= $ndt"
  14. exit 1
  15. fi
  16. pdt="$(date -u +%s)"
  17. dt=`echo 'insmod datehook; echo $YEAR-$MONTH-$DAY $HOUR:$MINUTE:$SECOND' | @builddir@/grub-shell`
  18. dtg="$(date -u -d "$dt" +%s)"
  19. ndt="$(date -u +%s)"
  20. if [ $pdt -gt $dtg ] || [ $dtg -gt $ndt ]; then
  21. echo "Date not in range: $pdt <= $dtg <= $ndt"
  22. exit 1
  23. fi