Prioritise GNU and Windows date programs over Mac and busybox
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
parent
67e34ace64
commit
d561a89eaf
@ -3710,14 +3710,15 @@ cert_date_to_timestamp_s - input error"
|
|||||||
|
|
||||||
in_date="$1"
|
in_date="$1"
|
||||||
|
|
||||||
# busybox
|
# OS dependencies
|
||||||
if busybox date --help > /dev/null 2>&1
|
# Linux and Windows
|
||||||
then
|
# date.exe does not allow +%s as input
|
||||||
timestamp_s="$(
|
# MacPorts GNU date
|
||||||
busybox date -D "%b %e %H:%M:%S %Y" \
|
if timestamp_s="$(
|
||||||
-d "$in_date" +%s 2>/dev/null
|
date -d "$in_date" +%s \
|
||||||
)" || die "\
|
2>/dev/null
|
||||||
cert_date_to_timestamp_s - timestamp_s - busybox $in_date"
|
)"
|
||||||
|
then : # ok
|
||||||
|
|
||||||
# Darwin, BSD
|
# Darwin, BSD
|
||||||
elif timestamp_s="$(
|
elif timestamp_s="$(
|
||||||
@ -3726,15 +3727,14 @@ cert_date_to_timestamp_s - timestamp_s - busybox $in_date"
|
|||||||
)"
|
)"
|
||||||
then : # ok
|
then : # ok
|
||||||
|
|
||||||
# OS dependencies
|
# busybox
|
||||||
# Linux and Windows
|
elif busybox date --help > /dev/null 2>&1
|
||||||
# date.exe does not allow +%s as input
|
then
|
||||||
# MacPorts GNU date
|
timestamp_s="$(
|
||||||
elif timestamp_s="$(
|
busybox date -D "%b %e %H:%M:%S %Y" \
|
||||||
date -d "$in_date" +%s \
|
-d "$in_date" +%s 2>/dev/null
|
||||||
2>/dev/null
|
)" || die "\
|
||||||
)"
|
cert_date_to_timestamp_s - timestamp_s - busybox $in_date"
|
||||||
then : # ok
|
|
||||||
|
|
||||||
# Something else
|
# Something else
|
||||||
else
|
else
|
||||||
@ -3759,17 +3759,16 @@ offset_days_to_cert_date - input error"
|
|||||||
|
|
||||||
in_offset="$1"
|
in_offset="$1"
|
||||||
|
|
||||||
# busybox (Alpine)
|
# OS dependencies
|
||||||
if busybox date --help > /dev/null 2>&1
|
# Linux and Windows
|
||||||
then
|
# date.exe does not allow +%s as input
|
||||||
offset_date="$(
|
# MacPorts GNU date
|
||||||
busybox date -u -d \
|
if offset_date="$(
|
||||||
"@$(( $(busybox date +%s) \
|
date -u -d "+${in_offset}days" \
|
||||||
+ in_offset * 86400 ))" \
|
|
||||||
"+%b %d %H:%M:%S %Y %Z" \
|
"+%b %d %H:%M:%S %Y %Z" \
|
||||||
2>/dev/null
|
2>/dev/null
|
||||||
)" || die "\
|
)"
|
||||||
offset_days_to_cert_date - offset_date - busybox"
|
then : # ok
|
||||||
|
|
||||||
# Darwin, BSD
|
# Darwin, BSD
|
||||||
elif offset_date="$(
|
elif offset_date="$(
|
||||||
@ -3779,16 +3778,17 @@ offset_days_to_cert_date - offset_date - busybox"
|
|||||||
)"
|
)"
|
||||||
then : # ok
|
then : # ok
|
||||||
|
|
||||||
# OS dependencies
|
# busybox (Alpine)
|
||||||
# Linux and Windows
|
elif busybox date --help > /dev/null 2>&1
|
||||||
# date.exe does not allow +%s as input
|
then
|
||||||
# MacPorts GNU date
|
offset_date="$(
|
||||||
elif offset_date="$(
|
busybox date -u -d \
|
||||||
date -u -d "+${in_offset}days" \
|
"@$(( $(busybox date +%s) \
|
||||||
|
+ in_offset * 86400 ))" \
|
||||||
"+%b %d %H:%M:%S %Y %Z" \
|
"+%b %d %H:%M:%S %Y %Z" \
|
||||||
2>/dev/null
|
2>/dev/null
|
||||||
)"
|
)" || die "\
|
||||||
then : # ok
|
offset_days_to_cert_date - offset_date - busybox"
|
||||||
|
|
||||||
# Something else
|
# Something else
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user