summaryrefslogtreecommitdiff
path: root/baserock-system-config-sync/baserock-system-config-sync
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-10-02 18:40:41 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-10-02 18:46:22 +0100
commit3190be6906eb21a1ba6878d3c8edb4bd16f925d7 (patch)
tree0ab542a7485178546d54e777d9432619c1c8020e /baserock-system-config-sync/baserock-system-config-sync
parentfb9bdefbbbdbd8fef01278b7c3d9c1592998f6d1 (diff)
parentfef35900a703ac8401e60a2fb89166b3a7e7a27b (diff)
downloadtbdiff-3190be6906eb21a1ba6878d3c8edb4bd16f925d7.tar.gz
Merge branch 'sam/allow-file-migrations'
Reviewed-By: Richard Ipsum <richard.ipsum@codethink.co.uk> Reviewed-By: Richard Maw <richard.maw@codethink.co.uk> Reviewed-By: Paul Sherwood <paul.sherwood@codethink.co.uk>
Diffstat (limited to 'baserock-system-config-sync/baserock-system-config-sync')
-rwxr-xr-xbaserock-system-config-sync/baserock-system-config-sync13
1 files changed, 11 insertions, 2 deletions
diff --git a/baserock-system-config-sync/baserock-system-config-sync b/baserock-system-config-sync/baserock-system-config-sync
index 7b7c697..061c86c 100755
--- a/baserock-system-config-sync/baserock-system-config-sync
+++ b/baserock-system-config-sync/baserock-system-config-sync
@@ -54,8 +54,17 @@ check_same_type() {
type1="$(file_type $1)"
type2="$(file_type $2)"
if [ "$type1" != "$type2" ]; then
- die "ERROR: found two different types for '$3':" \
- "$type1 and $type2"
+ if [ "$type1" = symlink ] || [ "$type2" = symlink ]; then
+ # We allow moving content and leaving a compatibility symlink, as
+ # long as the content of the file didn't change.
+ if ! cmp -s "$1" "$2"; then
+ die "ERROR: $3: replacing a file with a symlink is only " \
+ "supported if there are no changes to the content."
+ fi
+ else
+ die "ERROR: found two different types for '$3':" \
+ "$type1 and $type2"
+ fi
fi
}