Rearrange order of date checks

works for all "older" Linux systems, MacOS, OpenBSD and according to #teki69
also Ubuntu 25.10 .
This commit is contained in:
Dirk Wetter
2025-10-08 23:26:48 +02:00
parent 36bc08ce18
commit accd1f20cd

View File

@ -475,15 +475,15 @@ HAS_GNUDATE=false
HAS_FREEBSDDATE=false
HAS_OPENBSDDATE=false
if date -d @735275209 >/dev/null 2>&1; then
if date -r 735275209 >/dev/null 2>&1; then
# It can't do any conversion from a plain date output.
HAS_OPENBSDDATE=true
if date -r @735275209 >/dev/null 2>&1; then
# Ubuntu >= 25.10
HAS_GNUDATE=true
elif date -r 735275209 2>&1 | grep -q "No such file"; then
# e.g. Debian 24.04, Debian 11-13
HAS_GNUDATE=true
elif date -r @735275209 >/dev/null 2>&1; then
# Ubuntu >= 25.10
HAS_GNUDATE=true
elif date -r 735275209 >/dev/null 2>&1; then
# It can't do any conversion from a plain date output.
HAS_OPENBSDDATE=true
fi
fi
# FreeBSD and OS X date(1) accept "-f inputformat", so do newer OpenBSD versions >~ 6.6.