mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-22 06:41:17 +00:00
build: Fix Shellcheck for get_source_date_epoch.sh
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>
This commit is contained in:
parent
7d26f294cd
commit
ae87e53e33
@ -1,7 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
export LANG=C
|
||||
export LC_ALL=C
|
||||
[ -n "$TOPDIR" ] && cd $TOPDIR
|
||||
|
||||
if [ -n "$TOPDIR" ]; then
|
||||
cd "$TOPDIR" || exit 1
|
||||
fi
|
||||
|
||||
try_version() {
|
||||
[ -f version.date ] || return 1
|
||||
@ -22,7 +25,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" ]
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user