On Tue, 24 Jul 2018 16:40:48 +0100, Ralph Corderoy said:
How about
+fmt='%Y-%m-%d %T %z' +now=${SOURCE_DATE_EPOCH-$(date +%s)} +if date -u -d @42 +"$fmt" >/dev/null 2>&1; then # Coreutils. + date=$(date -u -d "@$now" +"$fmt") +elif date -u -r 42 +"$fmt" >/dev/null 2>&1; then # BSD. + date=$(date -u -r "$now" +"$fmt") +else # Posix, ignoring SOURCE_DATE_EPOCH. + date=$(date -u +"$fmt") +fi
Oh, much better than that date || date || date monstrosity - I was unable to figure out that the second one was intended for a different date binary than the first one
pgpbru7HT3P3g.pgp
Description: PGP signature
-- nmh-workers https://lists.nongnu.org/mailman/listinfo/nmh-workers
Previous by Date: | Re: [nmh-workers] Reproducible build patch, Robert Elz |
---|---|
Next by Date: | Re: [nmh-workers] Reproducible build patch, Ralph Corderoy |
Previous by Thread: | Re: [nmh-workers] Reproducible build patch, Ralph Corderoy |
Next by Thread: | Re: [nmh-workers] Reproducible build patch, Robert Elz |
Indexes: | [Date] [Thread] [Top] [All Lists] |