Relevant xkcd: https://xkcd.com/1179/
GNU/Linux date and FreeBSD date can both use the option -I, as verified with:
https://www.freebsd.org/cgi/man.cgi?query=date
However, the FreeBSD manual page also notes, that the option -I is an extension to an old POSIX standard. The BSD date from Mac OS X (macOS) may not have the the same extensions as the FreeBSD date. This was reported by Eduardo de Oliveira in:
https://gitlab.com/wsusoffline/bugtracker/-/issues/77
Then a plain format string could be used instead of the option -I. Both forms should return the same result, but a format string will be more compatible:
- Code: Select all
date -I
date "+%Y-%m-%d"
So basically, in the file 90-finalization.bash the line:
- Code: Select all
build_date="$(date -I)"
should be replaced with:
- Code: Select all
build_date="$(date "+%Y-%m-%d")"
A complete patch in unified diff format, with updated comments would be:
- Code: Select all
--- 90-finalization.bash.bak 2021-01-19 13:19:20.000000000 +0100
+++ 90-finalization.bash 2023-01-25 22:47:10.034662643 +0100
@@ -2,7 +2,7 @@
#
# Filename: 90-finalization.bash
#
-# Copyright (C) 2016-2021 Hartmut Buhrmester
+# Copyright (C) 2016-2023 Hartmut Buhrmester
# <wsusoffline-scripts-xxyh@hartmut-buhrmester.de>
#
# License
@@ -63,11 +63,15 @@
local build_date=""
# The date should be in an international format like 2015-11-26, also
- # known as ISO-8601. The option -I can be used with both GNU/Linux
- # and FreeBSD date.
+ # known as ISO-8601.
#
# Relevant xkcd: https://xkcd.com/1179/
- build_date="$(date -I)"
+ #
+ # For compatibility with all of GNU/Linux date, FreeBSD date and
+ # Mac OS X date, a plain format string is used. (The formerly used
+ # option -I is an extension to the POSIX standard, which is only
+ # found in GNU/Linux date and FreeBSD date.)
+ build_date="$(date "+%Y-%m-%d")"
# Remove existing files first, instead of overwriting, if hard links
# are used for backups or snapshots of the client directory
This works for both the master and the esr-11.9 development branches.
Greetings,
hbuhrmester