summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-04-04 19:45:50 +0100
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-04-04 19:45:50 +0100
commitb03d3cc271d6c91e2d64adeb6b7ed742fa26066e (patch)
tree5f190274d04bf957230bf4a809b91b0b444625ad /subr
parent2ec32931cedeeab8cc896576956e351574b69803 (diff)
downloadmidipix_build-b03d3cc271d6c91e2d64adeb6b7ed742fa26066e.tar.bz2
midipix_build-b03d3cc271d6c91e2d64adeb6b7ed742fa26066e.tar.xz
subr/rtl_complex.subr:rtl_is_newer(): reimplemented w/ stat(1).
subr/build_init.subr:buildp_init_prereqs(): adds stat(1).
Diffstat (limited to 'subr')
-rw-r--r--subr/build_init.subr2
-rw-r--r--subr/rtl_complex.subr13
2 files changed, 10 insertions, 5 deletions
diff --git a/subr/build_init.subr b/subr/build_init.subr
index 49f0dca8..668c0861 100644
--- a/subr/build_init.subr
+++ b/subr/build_init.subr
@@ -229,7 +229,7 @@ buildp_init_prereqs() {
g++ gcc git grep gunzip gzip hostname id install kill \
ln lzip make mkdir mkfifo mktemp mv paste patch perl \
pgrep pkill printf readlink rm sed sha256sum sort \
- tail tar test touch tr uniq wget xz zip; then
+ stat tail tar test touch tr uniq wget xz zip; then
printf "%s\n" "${_status}" >&2; exit 1;
elif ! (FNAME="$(mktemp)" && { trap "rm -f \"\${FNAME}\"" EXIT; \
sed -i'' -e '' "${FNAME}" >/dev/null 2>&1; }); then
diff --git a/subr/rtl_complex.subr b/subr/rtl_complex.subr
index 2c23cfe8..4a055515 100644
--- a/subr/rtl_complex.subr
+++ b/subr/rtl_complex.subr
@@ -164,11 +164,16 @@ rtl_head() {
};
rtl_is_newer() {
- local _new_fname="${1}" _old_fname="${2}";
- if [ -n "$(find -name "${_new_fname}" -newer "${_old_fname}" 2>/dev/null)" ]; then
+ local _new_fname="${1}" _old_fname="${2}" _new_ts="" _old_ts="";
+ if ! [ -e "${_old_fname}" ]; then
return 0;
- else
- return 1;
+ else _new_ts="$(stat -c %Y "${_new_fname}" 2>&1)";
+ _old_ts="$(stat -c %Y "${_old_fname}" 2>&1)";
+ if [ "${_new_ts:-0}" -gt "${_old_ts:-0}" ]; then
+ return 0;
+ else
+ return 1;
+ fi;
fi;
};