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