grub_cmd_date.in 767 B

12345678910111213141516171819202122232425262728293031
  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 77
  7. fi
  8. pdt="$(date -u +%s)"
  9. dt="$(echo date | @builddir@/grub-shell)"
  10. dt="$(echo "$dt" | sed 's, [A-Z][a-z]*$,,')"
  11. dtg="$(date -u -d "$dt" +%s)"
  12. ndt="$(date -u +%s)"
  13. if [ $pdt -gt $dtg ] || [ $dtg -gt $ndt ]; then
  14. echo "Date not in range: $pdt <= $dtg <= $ndt"
  15. exit 1
  16. fi
  17. pdt="$(date -u +%s)"
  18. dt=`echo 'insmod datehook; echo $YEAR-$MONTH-$DAY $HOUR:$MINUTE:$SECOND' | @builddir@/grub-shell`
  19. dtg="$(date -u -d "$dt" +%s)"
  20. ndt="$(date -u +%s)"
  21. if [ $pdt -gt $dtg ] || [ $dtg -gt $ndt ]; then
  22. echo "Date not in range: $pdt <= $dtg <= $ndt"
  23. exit 1
  24. fi