xref: /freebsd/contrib/ntp/scripts/build/checkHtmlFileDates (revision f5f40dd63bc7acbb5312b26ac1ea1103c12352a6)
12b15cb3dSCy Schubert#! /bin/sh
22b15cb3dSCy Schubert
3*f5f40dd6SCy Schubert#
4*f5f40dd6SCy Schubert# checkHtmlFileDates
5*f5f40dd6SCy Schubert#
6*f5f40dd6SCy Schubert# This script is invoked in html directory when any html/*.html file
7*f5f40dd6SCy Schubert# is newer than html/.datecheck to update the last modified time
8*f5f40dd6SCy Schubert# within the HTML.  Each file is compared against the checked-in
9*f5f40dd6SCy Schubert# version is compared to any uncommitted edits and if there are
10*f5f40dd6SCy Schubert# any, scripts/build/updateBEDate is used to update the embedded
11*f5f40dd6SCy Schubert# timestamp.  html/.datecheck is not distributed in releases so
12*f5f40dd6SCy Schubert# this will be invoked once building a newly-extracted tarball.
13*f5f40dd6SCy Schubert# 'bk diff' is used to check for modifications so if bk is not
14*f5f40dd6SCy Schubert# on the path there's no need to invoke this repeatedly.
15*f5f40dd6SCy Schubert# Therefore touch .datecheck unconditionally right away.
16*f5f40dd6SCy Schubert#
17*f5f40dd6SCy Schuberttouch .datecheck
182b15cb3dSCy Schubert
19*f5f40dd6SCy Schubert# Do nothing if the directory is not a BK repo,
20*f5f40dd6SCy Schubert# or if BK is not even installed.
21*f5f40dd6SCy Schubertbk status > /dev/null 2>&1 || exit 0
22*f5f40dd6SCy Schubert
23*f5f40dd6SCy Schubertfor i in `echo *.html`
242b15cb3dSCy Schubertdo
252b15cb3dSCy Schubert    # echo $i
26*f5f40dd6SCy Schubert    set `bk diff --normal $i | wc -l`
272b15cb3dSCy Schubert    lines=$1
282b15cb3dSCy Schubert    case "$lines" in
292b15cb3dSCy Schubert     0) ;;
302b15cb3dSCy Schubert     *) echo "Processing <$i>"
312b15cb3dSCy Schubert        ../scripts/build/updateBEDate $i
322b15cb3dSCy Schubert	;;
332b15cb3dSCy Schubert    esac
342b15cb3dSCy Schubertdone
35