blob: 8dabc2d2d389e95f7a3b61e42591c47e9b6313f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/bin/rc
#
# This script is very slow.
# Hence the option to use find's -newer.
# A file can be created before stagit runs,
# and this script will only modify files created after.
#
# stagit will not modify files in the commit/ dir once created
# It does however recreate everything at HEAD.
# This isn't ideal.
#
# Most of the time taken in this script is most likely NOT cpu time.
# It may be a good idea to run the main loop portion of this script in parallel.
wwwdir = /var/www/htdocs/src.hhvn.uk
newer = $1
cd $wwwdir
if (!~ $newer ()) {
fargs = (-newer $1)
}
fn breadcrumb {
printf %s '<h1>'
www/generate/breadcrumb $* | sed 's~&~\\\\\&~g'
printf %s '</h1>'
}
files = `$nl{find . $fargs -type f -name '*.html'}
estatus = 0
for (f in $files) {
printf %s 'BREADCRUMB ' ^ $f ^ '... '
breadcrumb = `''{breadcrumb $f hhvn.uk src}
awk -v breadcrumb=$breadcrumb '{ sub(/<h1>.*<\/h1>/, breadcrumb); sub(/<span class="desc">Repositories<\/span>/, breadcrumb) }1' < $f > $f.awk
if (~ $status 0) {
echo success
mv $f.awk $f
} else {
rm $f.awk
estatus = $status
}
}
|