mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2026-09-10 07:36:35 -04:00
gotta-patch-em: Simplify date error checking
We can unify the error message, and thereby also not relying on the mare existance of `--version` but on actual parsability of the timestamp. [note] Also increasing script versions after most recent changes. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
1f1aa4129a
commit
8461eadeca
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
# Nerd Fonts Version: 3.4.0
|
||||
# Script Version: 1.0.1
|
||||
# Script Version: 1.0.2
|
||||
# Generates original-source.otf from individual glyphs
|
||||
#
|
||||
# Idea & original code taken from
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
# Nerd Fonts Version: 3.4.0
|
||||
# Script Version: 1.4.5
|
||||
# Script Version: 1.4.6
|
||||
#
|
||||
# You can supply options to the font-patcher via environment variable NERDFONTS
|
||||
# That option will override the defaults (also defaults of THIS script).
|
||||
|
|
@ -210,18 +210,12 @@ then
|
|||
export SOURCE_DATE_EPOCH=$(date +%s)
|
||||
fi
|
||||
# Detect GNU vs BSD date implementations reliably
|
||||
if date --version >/dev/null 2>&1; then
|
||||
if date -R "--date=@${SOURCE_DATE_EPOCH}" >/dev/null 2>&1; then
|
||||
# GNU date (Linux and others)
|
||||
release_timestamp=$(date -R "--date=@${SOURCE_DATE_EPOCH}" 2>/dev/null) || {
|
||||
echo >&2 "$LINE_PREFIX Invalid release timestamp SOURCE_DATE_EPOCH: ${SOURCE_DATE_EPOCH}"
|
||||
exit 2
|
||||
}
|
||||
release_timestamp=$(date -R "--date=@${SOURCE_DATE_EPOCH}" 2>/dev/null)
|
||||
elif date -r "${SOURCE_DATE_EPOCH}" "+%a, %d %b %Y %H:%M:%S %z" >/dev/null 2>&1; then
|
||||
# BSD date (macOS) - uses -r with epoch seconds
|
||||
release_timestamp=$(date -r "${SOURCE_DATE_EPOCH}" "+%a, %d %b %Y %H:%M:%S %z") || {
|
||||
echo >&2 "$LINE_PREFIX Invalid release timestamp SOURCE_DATE_EPOCH: ${SOURCE_DATE_EPOCH}"
|
||||
exit 2
|
||||
}
|
||||
release_timestamp=$(date -r "${SOURCE_DATE_EPOCH}" "+%a, %d %b %Y %H:%M:%S %z")
|
||||
else
|
||||
echo >&2 "$LINE_PREFIX Invalid release timestamp SOURCE_DATE_EPOCH: ${SOURCE_DATE_EPOCH}"
|
||||
exit 2
|
||||
|
|
|
|||
Loading…
Reference in a new issue