summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-10-02 17:40:41 (GMT)
committerSam Thursfield <sam.thursfield@codethink.co.uk>2014-10-02 17:46:22 (GMT)
commit3190be6906eb21a1ba6878d3c8edb4bd16f925d7 (patch)
tree0ab542a7485178546d54e777d9432619c1c8020e
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>
-rwxr-xr-xbaserock-system-config-sync/baserock-system-config-sync13
l---------tests/bscs-merge.pass/regular.symb.in/systems/default (renamed from tests/bscs-merge.fail/regular.symb.in/systems/default)0
-rw-r--r--tests/bscs-merge.pass/regular.symb.in/systems/factory/orig/etc/1 (renamed from tests/bscs-merge.fail/regular.symb.in/systems/version2/run/etc/1)0
l---------tests/bscs-merge.pass/regular.symb.in/systems/factory/run/etc/1 (renamed from tests/bscs-merge.fail/regular.symb.in/systems/factory/run/etc/1)0
-rw-r--r--tests/bscs-merge.pass/regular.symb.in/systems/factory/run/etc/afile (renamed from tests/bscs-merge.fail/regular.symb.in/systems/factory/run/etc/afile)0
-rw-r--r--tests/bscs-merge.pass/regular.symb.in/systems/version2/orig/etc/1 (renamed from tests/bscs-merge.fail/regular.symb.in/systems/version2/orig/etc/1)0
-rw-r--r--tests/bscs-merge.pass/regular.symb.in/systems/version2/run/etc/1 (renamed from tests/bscs-merge.fail/regular.symb.in/systems/factory/orig/etc/1)0
l---------tests/bscs-merge.pass/regular.symb.out/systems/default1
-rw-r--r--tests/bscs-merge.pass/regular.symb.out/systems/factory/orig/etc/10
l---------tests/bscs-merge.pass/regular.symb.out/systems/factory/run/etc/11
-rw-r--r--tests/bscs-merge.pass/regular.symb.out/systems/factory/run/etc/afile0
-rw-r--r--tests/bscs-merge.pass/regular.symb.out/systems/version2/orig/etc/10
-rw-r--r--tests/bscs-merge.pass/regular.symb.out/systems/version2/run/etc/10
-rw-r--r--tests/bscs-merge.pass/regular.symb.out/systems/version2/run/etc/afile0
-rw-r--r--tests/bscs-merge.pass/symblinks.in/systems/factory/orig/etc/os-release2
-rw-r--r--tests/bscs-merge.pass/symblinks.in/systems/factory/run/etc/os-release2
l---------tests/bscs-merge.pass/symblinks.in/systems/version2/orig/etc/os-release1
-rw-r--r--tests/bscs-merge.pass/symblinks.in/systems/version2/orig/usr/lib/os-release2
l---------tests/bscs-merge.pass/symblinks.in/systems/version2/run/etc/os-release1
-rw-r--r--tests/bscs-merge.pass/symblinks.in/systems/version2/run/usr/lib/os-release2
-rw-r--r--tests/bscs-merge.pass/symblinks.out/systems/factory/orig/etc/os-release2
-rw-r--r--tests/bscs-merge.pass/symblinks.out/systems/factory/run/etc/os-release2
l---------tests/bscs-merge.pass/symblinks.out/systems/version2/orig/etc/os-release1
-rw-r--r--tests/bscs-merge.pass/symblinks.out/systems/version2/orig/usr/lib/os-release2
l---------tests/bscs-merge.pass/symblinks.out/systems/version2/run/etc/os-release1
-rw-r--r--tests/bscs-merge.pass/symblinks.out/systems/version2/run/usr/lib/os-release2
26 files changed, 33 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
}
diff --git a/tests/bscs-merge.fail/regular.symb.in/systems/default b/tests/bscs-merge.pass/regular.symb.in/systems/default
index 0f51808..0f51808 120000
--- a/tests/bscs-merge.fail/regular.symb.in/systems/default
+++ b/tests/bscs-merge.pass/regular.symb.in/systems/default
diff --git a/tests/bscs-merge.fail/regular.symb.in/systems/version2/run/etc/1 b/tests/bscs-merge.pass/regular.symb.in/systems/factory/orig/etc/1
index e69de29..e69de29 100644
--- a/tests/bscs-merge.fail/regular.symb.in/systems/version2/run/etc/1
+++ b/tests/bscs-merge.pass/regular.symb.in/systems/factory/orig/etc/1
diff --git a/tests/bscs-merge.fail/regular.symb.in/systems/factory/run/etc/1 b/tests/bscs-merge.pass/regular.symb.in/systems/factory/run/etc/1
index 6a93f4f..6a93f4f 120000
--- a/tests/bscs-merge.fail/regular.symb.in/systems/factory/run/etc/1
+++ b/tests/bscs-merge.pass/regular.symb.in/systems/factory/run/etc/1
diff --git a/tests/bscs-merge.fail/regular.symb.in/systems/factory/run/etc/afile b/tests/bscs-merge.pass/regular.symb.in/systems/factory/run/etc/afile
index e69de29..e69de29 100644
--- a/tests/bscs-merge.fail/regular.symb.in/systems/factory/run/etc/afile
+++ b/tests/bscs-merge.pass/regular.symb.in/systems/factory/run/etc/afile
diff --git a/tests/bscs-merge.fail/regular.symb.in/systems/version2/orig/etc/1 b/tests/bscs-merge.pass/regular.symb.in/systems/version2/orig/etc/1
index e69de29..e69de29 100644
--- a/tests/bscs-merge.fail/regular.symb.in/systems/version2/orig/etc/1
+++ b/tests/bscs-merge.pass/regular.symb.in/systems/version2/orig/etc/1
diff --git a/tests/bscs-merge.fail/regular.symb.in/systems/factory/orig/etc/1 b/tests/bscs-merge.pass/regular.symb.in/systems/version2/run/etc/1
index e69de29..e69de29 100644
--- a/tests/bscs-merge.fail/regular.symb.in/systems/factory/orig/etc/1
+++ b/tests/bscs-merge.pass/regular.symb.in/systems/version2/run/etc/1
diff --git a/tests/bscs-merge.pass/regular.symb.out/systems/default b/tests/bscs-merge.pass/regular.symb.out/systems/default
new file mode 120000
index 0000000..0f51808
--- /dev/null
+++ b/tests/bscs-merge.pass/regular.symb.out/systems/default
@@ -0,0 +1 @@
+factory \ No newline at end of file
diff --git a/tests/bscs-merge.pass/regular.symb.out/systems/factory/orig/etc/1 b/tests/bscs-merge.pass/regular.symb.out/systems/factory/orig/etc/1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/bscs-merge.pass/regular.symb.out/systems/factory/orig/etc/1
diff --git a/tests/bscs-merge.pass/regular.symb.out/systems/factory/run/etc/1 b/tests/bscs-merge.pass/regular.symb.out/systems/factory/run/etc/1
new file mode 120000
index 0000000..6a93f4f
--- /dev/null
+++ b/tests/bscs-merge.pass/regular.symb.out/systems/factory/run/etc/1
@@ -0,0 +1 @@
+afile \ No newline at end of file
diff --git a/tests/bscs-merge.pass/regular.symb.out/systems/factory/run/etc/afile b/tests/bscs-merge.pass/regular.symb.out/systems/factory/run/etc/afile
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/bscs-merge.pass/regular.symb.out/systems/factory/run/etc/afile
diff --git a/tests/bscs-merge.pass/regular.symb.out/systems/version2/orig/etc/1 b/tests/bscs-merge.pass/regular.symb.out/systems/version2/orig/etc/1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/bscs-merge.pass/regular.symb.out/systems/version2/orig/etc/1
diff --git a/tests/bscs-merge.pass/regular.symb.out/systems/version2/run/etc/1 b/tests/bscs-merge.pass/regular.symb.out/systems/version2/run/etc/1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/bscs-merge.pass/regular.symb.out/systems/version2/run/etc/1
diff --git a/tests/bscs-merge.pass/regular.symb.out/systems/version2/run/etc/afile b/tests/bscs-merge.pass/regular.symb.out/systems/version2/run/etc/afile
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/bscs-merge.pass/regular.symb.out/systems/version2/run/etc/afile
diff --git a/tests/bscs-merge.pass/symblinks.in/systems/factory/orig/etc/os-release b/tests/bscs-merge.pass/symblinks.in/systems/factory/orig/etc/os-release
new file mode 100644
index 0000000..39715ee
--- /dev/null
+++ b/tests/bscs-merge.pass/symblinks.in/systems/factory/orig/etc/os-release
@@ -0,0 +1,2 @@
+Hi, I'm 'os-release'. I start out living in /etc, but then I get moved to
+/usr/lib and I'm replaced with a compatibility symlink.
diff --git a/tests/bscs-merge.pass/symblinks.in/systems/factory/run/etc/os-release b/tests/bscs-merge.pass/symblinks.in/systems/factory/run/etc/os-release
new file mode 100644
index 0000000..39715ee
--- /dev/null
+++ b/tests/bscs-merge.pass/symblinks.in/systems/factory/run/etc/os-release
@@ -0,0 +1,2 @@
+Hi, I'm 'os-release'. I start out living in /etc, but then I get moved to
+/usr/lib and I'm replaced with a compatibility symlink.
diff --git a/tests/bscs-merge.pass/symblinks.in/systems/version2/orig/etc/os-release b/tests/bscs-merge.pass/symblinks.in/systems/version2/orig/etc/os-release
new file mode 120000
index 0000000..c4c75b4
--- /dev/null
+++ b/tests/bscs-merge.pass/symblinks.in/systems/version2/orig/etc/os-release
@@ -0,0 +1 @@
+../usr/lib/os-release \ No newline at end of file
diff --git a/tests/bscs-merge.pass/symblinks.in/systems/version2/orig/usr/lib/os-release b/tests/bscs-merge.pass/symblinks.in/systems/version2/orig/usr/lib/os-release
new file mode 100644
index 0000000..39715ee
--- /dev/null
+++ b/tests/bscs-merge.pass/symblinks.in/systems/version2/orig/usr/lib/os-release
@@ -0,0 +1,2 @@
+Hi, I'm 'os-release'. I start out living in /etc, but then I get moved to
+/usr/lib and I'm replaced with a compatibility symlink.
diff --git a/tests/bscs-merge.pass/symblinks.in/systems/version2/run/etc/os-release b/tests/bscs-merge.pass/symblinks.in/systems/version2/run/etc/os-release
new file mode 120000
index 0000000..c4c75b4
--- /dev/null
+++ b/tests/bscs-merge.pass/symblinks.in/systems/version2/run/etc/os-release
@@ -0,0 +1 @@
+../usr/lib/os-release \ No newline at end of file
diff --git a/tests/bscs-merge.pass/symblinks.in/systems/version2/run/usr/lib/os-release b/tests/bscs-merge.pass/symblinks.in/systems/version2/run/usr/lib/os-release
new file mode 100644
index 0000000..39715ee
--- /dev/null
+++ b/tests/bscs-merge.pass/symblinks.in/systems/version2/run/usr/lib/os-release
@@ -0,0 +1,2 @@
+Hi, I'm 'os-release'. I start out living in /etc, but then I get moved to
+/usr/lib and I'm replaced with a compatibility symlink.
diff --git a/tests/bscs-merge.pass/symblinks.out/systems/factory/orig/etc/os-release b/tests/bscs-merge.pass/symblinks.out/systems/factory/orig/etc/os-release
new file mode 100644
index 0000000..39715ee
--- /dev/null
+++ b/tests/bscs-merge.pass/symblinks.out/systems/factory/orig/etc/os-release
@@ -0,0 +1,2 @@
+Hi, I'm 'os-release'. I start out living in /etc, but then I get moved to
+/usr/lib and I'm replaced with a compatibility symlink.
diff --git a/tests/bscs-merge.pass/symblinks.out/systems/factory/run/etc/os-release b/tests/bscs-merge.pass/symblinks.out/systems/factory/run/etc/os-release
new file mode 100644
index 0000000..39715ee
--- /dev/null
+++ b/tests/bscs-merge.pass/symblinks.out/systems/factory/run/etc/os-release
@@ -0,0 +1,2 @@
+Hi, I'm 'os-release'. I start out living in /etc, but then I get moved to
+/usr/lib and I'm replaced with a compatibility symlink.
diff --git a/tests/bscs-merge.pass/symblinks.out/systems/version2/orig/etc/os-release b/tests/bscs-merge.pass/symblinks.out/systems/version2/orig/etc/os-release
new file mode 120000
index 0000000..c4c75b4
--- /dev/null
+++ b/tests/bscs-merge.pass/symblinks.out/systems/version2/orig/etc/os-release
@@ -0,0 +1 @@
+../usr/lib/os-release \ No newline at end of file
diff --git a/tests/bscs-merge.pass/symblinks.out/systems/version2/orig/usr/lib/os-release b/tests/bscs-merge.pass/symblinks.out/systems/version2/orig/usr/lib/os-release
new file mode 100644
index 0000000..39715ee
--- /dev/null
+++ b/tests/bscs-merge.pass/symblinks.out/systems/version2/orig/usr/lib/os-release
@@ -0,0 +1,2 @@
+Hi, I'm 'os-release'. I start out living in /etc, but then I get moved to
+/usr/lib and I'm replaced with a compatibility symlink.
diff --git a/tests/bscs-merge.pass/symblinks.out/systems/version2/run/etc/os-release b/tests/bscs-merge.pass/symblinks.out/systems/version2/run/etc/os-release
new file mode 120000
index 0000000..c4c75b4
--- /dev/null
+++ b/tests/bscs-merge.pass/symblinks.out/systems/version2/run/etc/os-release
@@ -0,0 +1 @@
+../usr/lib/os-release \ No newline at end of file
diff --git a/tests/bscs-merge.pass/symblinks.out/systems/version2/run/usr/lib/os-release b/tests/bscs-merge.pass/symblinks.out/systems/version2/run/usr/lib/os-release
new file mode 100644
index 0000000..39715ee
--- /dev/null
+++ b/tests/bscs-merge.pass/symblinks.out/systems/version2/run/usr/lib/os-release
@@ -0,0 +1,2 @@
+Hi, I'm 'os-release'. I start out living in /etc, but then I get moved to
+/usr/lib and I'm replaced with a compatibility symlink.