set-source-date-epoch-to-latest: fix warning

If there was no older file than $NIX_BUILD_TOP this would result in a
warning, e.g. with nix-info.

```
/nix/store/15kgcm8hnd99p7plqzx7p4lcr2jni4df-set-source-date-epoch-to-latest.sh: line 13: [: : integer expression expected
```
This commit is contained in:
Robin Gloster 2018-11-29 09:49:08 +01:00
parent 8e97e8009f
commit 34faed5bb0
No known key found for this signature in database
GPG key ID: D5C458DF6DD97EDF

View file

@ -10,7 +10,7 @@ updateSourceDateEpoch() {
local newestFile="${res[1]}"
# Update $SOURCE_DATE_EPOCH if the most recent file we found is newer.
if [ "$time" -gt "$SOURCE_DATE_EPOCH" ]; then
if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then
echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile"
export SOURCE_DATE_EPOCH="$time"