dip

old school recipes for janitorial snafu.
git clone git://git.ricketyspace.net/dip.git
Log | Files | Refs

commit 87999b8ded8c62cd65b23e2f40d5ded6306b55b4
parent 0b39b62f0529462867e858c3470574de11107f88
Author: rsiddharth <s@ricketyspace.net>
Date:   Tue,  7 Aug 2018 21:47:51 +0000

usr/local/bin: Update tball (file_updated).

Add function file_updated.

Diffstat:
usr/local/bin/tball | 18++++++++++++++++++
1 file changed, 18 insertions(+), 0 deletions(-)

diff --git a/usr/local/bin/tball b/usr/local/bin/tball @@ -54,6 +54,24 @@ clean_tmp() { rm -rf $1 } +file_updated() { + local SRC=$1 + local DEST=$2 + + # Get modified time for file + local FTIME=$(stat -t $SRC | cut -d ' ' -f 13) + + # Get the last time source was tballed. + local TBALLT=$(find $DEST -type f -name '.suffixes' -exec cat '{}' \; \ + | tail -n 1) + [[ -z $TBALLT ]] && return 1 # source not tballed at all. + + # Check if file was updated after the last tball. + [[ $FTIME -gt $TBALLT ]] && return 1 + + return 0 +} + tb() { local SRC=${1/#\~/$HOME} local BDEST=${2/#\~/$HOME}