summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-02-26 17:29:30 +0000
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-03-06 15:34:16 +0000
commit8ea4bfba8076af0f325b7be11761e64f2c96819b (patch)
treeac0416967126bafe114c3a8705aaaffddbfd0970
parent2c6259f156087e2b99d02666c5323d598aca9f45 (diff)
downloadtbdiff-8ea4bfba8076af0f325b7be11761e64f2c96819b.tar.gz
baserock-system-config-sync: Add some logging to the standard output.
-rwxr-xr-xbaserock-system-config-sync/baserock-system-config-sync15
1 files changed, 15 insertions, 0 deletions
diff --git a/baserock-system-config-sync/baserock-system-config-sync b/baserock-system-config-sync/baserock-system-config-sync
index 7321a1b..47da83d 100755
--- a/baserock-system-config-sync/baserock-system-config-sync
+++ b/baserock-system-config-sync/baserock-system-config-sync
@@ -139,18 +139,23 @@ merge_regular_file() {
'exists none none')
# Do nothing, if the file was removed in vu and v2 doesn't have it,
# then the file is not longer needed
+ echo "File $v1 was removed by the user, no longer exists"
;;
'none exists none')
cp -a "$vu" "$vt"
+ echo "File $vu created by the user, copied to $vt"
;;
'none none exists')
cp -a "$v2" "$vt"
+ echo "File $v2 only present in the new version, copied to $vt"
;;
'exists none exists')
cp -a "$v2" "$vt"
+ echo "File $v2, removed by the user, copied to $vt"
;;
'exists exists none')
cp -a "$vu" "$vt"
+ echo "File $vu, not present in the new version, copied to $vt"
;;
'none exists exists')
cp -a "$v2" "$vt"
@@ -160,7 +165,12 @@ merge_regular_file() {
if ! (diff -u "$v2" --label="$v2" "$vu" --label="$vu" | patch "$vt" -f); then
cp -a "$v2" "$vt" # merge failed, use v2
# 'patch' creates a file '.rej' with the diff that did not apply
+ echo "File $vt left as it was in $v2 as merging failed"
+ else
+ echo "File $vt was pached with diff between $v2 and $vu"
fi
+ else
+ echo "Files $vu and $v2 are the same, not patching"
fi
;;
'exists exists exists')
@@ -171,7 +181,12 @@ merge_regular_file() {
if ! (diff -u "$v1" --label="$v1" "$vu" --label="$vu" | patch "$vt" -f); then
cp -a "$v2" "$vt" # merge failed, use v2
# 'patch' creates a file '.rej' with the diff that did not apply
+ echo "File $vt left as it was in $v2 as merging failed"
+ else
+ echo "File $vt was pached with diff between $v1 and $vu"
fi
+ else
+ echo "Files $vu and $v2 are the same, not patching"
fi
;;
*)