summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2014-01-21 02:41:08 +0000
committerAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2014-01-21 02:41:08 +0000
commitd0b2f2fc16557ca1ae856cca885da4b6f47a9b94 (patch)
tree82714d968c029a4fbc9717e4ed8cce31620b1ebb
parent818785f1d6c9d0d05d8d37e7efbfa0a25541d99a (diff)
downloadbcfg2-tools-d0b2f2fc16557ca1ae856cca885da4b6f47a9b94.tar.gz
bcfg2-tools-d0b2f2fc16557ca1ae856cca885da4b6f47a9b94.tar.bz2
bcfg2-tools-d0b2f2fc16557ca1ae856cca885da4b6f47a9b94.zip
renew-config: more convenience if clients.xml differs
If the copy of clients.xml in the repo differs from the real version used by bcfg2 display a nice diff and show the cmd that could be used to update the file.
-rwxr-xr-xrenew-config9
-rw-r--r--settings.sh5
2 files changed, 12 insertions, 2 deletions
diff --git a/renew-config b/renew-config
index fbd05c7..6b4a24c 100755
--- a/renew-config
+++ b/renew-config
@@ -14,8 +14,13 @@ git fetch origin 2>/dev/null
git push origin master 2>/dev/null
if ! diff -q "$REPO/Metadata/clients.xml" "$REAL/Metadata/clients.xml" >/dev/null; then
- error "$REPO: Metadata/clients.xml out of date.
-You probably should update it with $REAL/Metadata/clients.xml"
+ echo "$REPO: Metadata/clients.xml out of date." 1>&2
+ echo "You probably should update it with $REAL/Metadata/clients.xml" 1>&2
+ echo 1>&2
+ $DIFF -u "$REPO/Metadata/clients.xml" "$REAL/Metadata/clients.xml" 1>&2
+ echo 1>&2
+ echo "Maybe you want:" 1>&2
+ error "cp -i '$REAL/Metadata/clients.xml' '$REPO/Metadata/clients.xml'"
fi
if [ -n "$(git rev-list HEAD..origin/master)" ]; then
diff --git a/settings.sh b/settings.sh
index e954101..48699a8 100644
--- a/settings.sh
+++ b/settings.sh
@@ -3,6 +3,11 @@ REAL="/var/lib/bcfg2"
OLDPWD="$(pwd)"
BINDIR="$( cd -P "$( dirname -- "$0" )" >/dev/null && pwd )"
+DIFF=diff
+if hash colordiff >/dev/null 2>&1; then
+ DIFF=colordiff
+fi
+
error() {
echo "$@" 1>&2
cd "$OLDPWD" >/dev/null