From: Ian Jackson Date: Fri, 10 Jun 2016 17:54:20 +0000 (+0100) Subject: New substitute machinery X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;ds=sidebyside;h=54850ae619300ca6cf8c53d285205ec179c6852f;p=ian-dotfiles.git New substitute machinery --- diff --git a/infra/substitute b/infra/substitute new file mode 100755 index 0000000..112e046 --- /dev/null +++ b/infra/substitute @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +mode_subst () { + $fn >$bfn.new +} + +mode_diff () { + diff -u $dot $bfn.new || test $? = 1 +} + +mode_install () { + mv -f $bfn.new $dot +} + +mode=$1 +case "$mode" in +subst|diff|install) ;; +*) echo >&2 'bad mode'; exit 1; +esac +shift + +for fn in templates/*.in; do + bfn=${fn%.in} + dot=$HOME/.${bfn#*/} + mode_$mode +done diff --git a/infra/template b/infra/template new file mode 100644 index 0000000..6d1dae0 --- /dev/null +++ b/infra/template @@ -0,0 +1,5 @@ +# -*- sh -*- + +cd dot/configs +eval `./checkconfig` +cd ../.. diff --git a/templates/gitconfig.in b/templates/gitconfig.in new file mode 100755 index 0000000..7e874d2 --- /dev/null +++ b/templates/gitconfig.in @@ -0,0 +1,32 @@ +#!/bin/bash +set -e +. infra/template + +case "$(hostname -f)" in +*.xensource.com) + email="ian.jackson@eu.citrix.com" + cache=git://git-cache.xs.citrite.net:9419 + ;; +*) + email=ijackson@chiark.greenend.org.uk + ;; +esac + +cat <