1#! /bin/sh
2
3#
4# checkHtmlFileDates
5#
6# This script is invoked in html directory when any html/*.html file
7# is newer than html/.datecheck to update the last modified time
8# within the HTML.  Each file is compared against the checked-in
9# version is compared to any uncommitted edits and if there are
10# any, scripts/build/updateBEDate is used to update the embedded
11# timestamp.  html/.datecheck is not distributed in releases so
12# this will be invoked once building a newly-extracted tarball.
13# 'bk diff' is used to check for modifications so if bk is not
14# on the path there's no need to invoke this repeatedly.
15# Therefore touch .datecheck unconditionally right away.
16#
17touch .datecheck
18
19# Do nothing if the directory is not a BK repo,
20# or if BK is not even installed.
21bk status > /dev/null 2>&1 || exit 0
22
23for i in `echo *.html`
24do
25    # echo $i
26    set `bk diff --normal $i | wc -l`
27    lines=$1
28    case "$lines" in
29     0) ;;
30     *) echo "Processing <$i>"
31        ../scripts/build/updateBEDate $i
32	;;
33    esac
34done
35