vaseboot/tests/VasEBoot_cmd_date.in

31 lines
788 B
Plaintext

#! @BUILD_SHEBANG@
set -ex
. "@builddir@/VasEBoot-core/modinfo.sh"
# FIXME: OpenBIOS on sparc64 doesn't implement RTC
if [ "${VasEBoot_modinfo_target_cpu}-${VasEBoot_modinfo_platform}" = sparc64-ieee1275 ]; then
exit 77
fi
pdt="$(date -u +%s)"
dt="$(echo date | @builddir@/VasEBoot-shell)"
dt="$(echo "$dt" | 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@/VasEBoot-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