chiark
/
gitweb
/
~ian
/
ian-dotfiles.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
New substitute machinery
[ian-dotfiles.git]
/
infra
/
substitute
1
#!/bin/bash
2
set -e
3
4
mode_subst () {
5
$fn >$bfn.new
6
}
7
8
mode_diff () {
9
diff -u $dot $bfn.new || test $? = 1
10
}
11
12
mode_install () {
13
mv -f $bfn.new $dot
14
}
15
16
mode=$1
17
case "$mode" in
18
subst|diff|install) ;;
19
*) echo >&2 'bad mode'; exit 1;
20
esac
21
shift
22
23
for fn in templates/*.in; do
24
bfn=${fn%.in}
25
dot=$HOME/.${bfn#*/}
26
mode_$mode
27
done