summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorPhil Pennock <pdp@exim.org>2018-04-08 22:43:36 -0400
committerPhil Pennock <pdp@exim.org>2018-04-08 22:43:36 -0400
commit7a128512684cd0ece3d4dde369ebc5b7af360f06 (patch)
tree0a7ea9ec7b380ab9860f6cf4c06a0e39f1568dc2 /src/util
parentddd16464764026559f8efe414ca6ac05406618a4 (diff)
downloadexim4-7a128512684cd0ece3d4dde369ebc5b7af360f06.tar.gz
stat portability
I forgot how much I loathe basic stuff like "get the size of a file, portably, in shell". Bleh.
Diffstat (limited to 'src/util')
-rwxr-xr-xsrc/util/renew-opendmarc-tlds.sh16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/util/renew-opendmarc-tlds.sh b/src/util/renew-opendmarc-tlds.sh
index c276fcd5f..2ce937699 100755
--- a/src/util/renew-opendmarc-tlds.sh
+++ b/src/util/renew-opendmarc-tlds.sh
@@ -13,7 +13,7 @@
# Create a cron-job as the Exim run-time user to invoke this daily, with a
# single parameter, 'cron'. Eg:
#
-# 3 4 * * * /usr/local/sbin/renew-opendmarc-tlds.sh cron
+# 3 4 * * * /usr/local/sbin/renew-opendmarc-tlds.sh cron
#
# That will, at 3 minutes past the 4th hour (in whatever timezone cron is
# running it) invoke this script with 'cron'; we will then sleep between 10 and
@@ -77,9 +77,17 @@ fetch_candidate() {
curl --user-agent "$CurlUserAgent" -fSs -o "${WorkingFile}" "${URL}"
}
-size_of() {
- stat -c %s "$1"
-}
+case $(uname -s) in
+*BSD|Darwin)
+ size_of() { stat -f %z "$1"; }
+ ;;
+Linux)
+ size_of() { stat -c %s "$1"; }
+ ;;
+*) # optimism?
+ size_of() { stat -c %s "$1"; }
+ ;;
+esac
sanity_check_candidate() {
local new_size prev_size re