improved how stat tool is used

Detect were the stat tool is located.  If no stat tool is found,
set `$STAT_TOOL` to `false`.  Cleanup comments related to
determining the modification time of a file.

Changed `bin/gen-sitemap.sh` VERSION from "1.3.8 2024-04-28"
to "1.3.9 2024-06-21".

Changed `bin/gen-status.sh` VERSION from "1.5.2 2024-04-30"
to "1.5.3 2024-06-21".

Perform `make www` to perform the above and test under macOS.
This commit is contained in:
Landon Curt Noll committed 2024-06-21 21:44:23 -07:00
1 parent 8fb4edb6f5
commit ccc53f83e5
2 files changed
+15 -24

No files matched your search

+2 -9
View File
@@ -84,7 +84,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an
# set variables referenced in the usage message
#
export VERSION="1.5.2 2024-04-30"
export VERSION="1.5.3 2024-06-21"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -113,8 +113,7 @@ if [[ -z "$JPARSE_TOOL" ]]; then
fi
STAT_TOOL=$(type -P stat)
if [[ -z "$STAT_TOOL" ]]; then
echo "$0: FATAL: stat tool is not installed or not in \$PATH" 1>&2
exit 5
STAT_TOOL="false" # we have no stat tool
fi
LS_TOOL=$(type -P ls)
@@ -697,8 +696,6 @@ export NEXT_DIR="next"
#
# Try macOS stat:
#
# TZ=UTC stat -f '%Sm' -t '%FT%T+00:00' filename
#
TZ=UTC "$STAT_TOOL" -f '%Sm' -t '%FT%T+00:00' "$TOP_FILE" > /dev/null 2>&1
status="$?"
if [[ $status -eq 0 ]]; then
@@ -711,8 +708,6 @@ else
# Try RHEL Linux stat:
#
# TZ=UTC stat -c '%y' faq.md | sed -e 's/ /T/' -e 's/\.[0-9]* //' -e 's/\([0-9][0-9]\)$/:&/'
#
# NOTE: We only need to test the stat command.
#
TZ=UTC "$STAT_TOOL" -c '%y' "$TOP_FILE" > /dev/null 2>&1
@@ -727,8 +722,6 @@ else
# Try ls -D:
#
# TZ=UTZ ls -D '%FT%T+00:00' -ld
#
TZ=UTZ "$LS_TOOL" -D '%FT%T+00:00' -ld "$TOP_FILE" > /dev/null 2>&1
status="$?"
if [[ $status -eq 0 ]]; then