Message ID | 20200814001724.2539178-2-mail@aparcar.org |
---|---|
State | Superseded |
Headers | show |
Series | Granular timestamps in packages | expand |
diff --git a/scripts/get_source_date_epoch.sh b/scripts/get_source_date_epoch.sh index 84ba445454..3e277d3a94 100755 --- a/scripts/get_source_date_epoch.sh +++ b/scripts/get_source_date_epoch.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash export LANG=C export LC_ALL=C -[ -n "$TOPDIR" ] && cd $TOPDIR +[ -n "$TOPDIR" ] && cd "$TOPDIR" || exit 1 try_version() { [ -f version.date ] || return 1 @@ -22,7 +22,7 @@ try_hg() { } try_mtime() { - perl -e 'print((stat $ARGV[0])[9])' "$0" + SOURCE_DATE_EPOCH=$(perl -e 'print((stat $ARGV[0])[9])' "$0") [ -n "$SOURCE_DATE_EPOCH" ] }
If a `cd` to `TOPDIR` fails the script should quit. Also unify `try_mtime` function by storing it in a variable. Signed-off-by: Paul Spooren <mail@aparcar.org> --- scripts/get_source_date_epoch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)