diff --git a/src/man/mkman.sh b/src/man/mkman.sh index 00c4ffe720f..65a31b2e513 100755 --- a/src/man/mkman.sh +++ b/src/man/mkman.sh @@ -5,8 +5,15 @@ set -e -MONTH="$(LC_ALL=C date -u --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%b)" -YEAR="$(LC_ALL=C date -u --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y)" +test -z "$SOURCE_DATE_EPOCH" && SOURCE_DATE_EPOCH="$(date +%s)" + +if LC_ALL=C date -d "@$SOURCE_DATE_EPOCH" >/dev/null 2>/dev/null; then + MONTH="$(LC_ALL=C date -u -d "@$SOURCE_DATE_EPOCH" +%b)" + YEAR="$(LC_ALL=C date -u -d "@$SOURCE_DATE_EPOCH" +%Y)" +else + MONTH="$(LC_ALL=C date -u +%b)" + YEAR="$(LC_ALL=C date -u +%Y)" +fi sed \ -e "s/VERSION/$1/g" \