mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-09 02:43:53 +08: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
|
#!/usr/bin/env bash
|
||||||
export LANG=C
|
export LANG=C
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
[ -n "$TOPDIR" ] && cd $TOPDIR
|
|
||||||
|
if [ -n "$TOPDIR" ]; then
|
||||||
|
cd "$TOPDIR" || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
try_version() {
|
try_version() {
|
||||||
[ -f version.date ] || return 1
|
[ -f version.date ] || return 1
|
||||||
@ -22,7 +25,7 @@ try_hg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try_mtime() {
|
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" ]
|
[ -n "$SOURCE_DATE_EPOCH" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user