diff options
authorPedro Alvarez <>2016-09-22 14:04:19 (GMT)
committerPedro Alvarez <>2016-09-22 14:11:47 (GMT)
commite17a444c651451724046e7da1ae2559e71478b3a (patch)
parent06f3271314b72e0065cc638fcfa7695d56ddb2e2 (diff)
Handle better the case where a symlink disappears in v2HEADmaster
When a symlink hasn't changed from v1 to vu, we were using by default v2. But this was failing in some cases where v2 didn't include this symlink. Now, if v2 doesn't have that file, we use vu, to be consistent with the behaviour of merging regular files. Change-Id: I8741e0bd0722d48d3d031a779f5fbde6a4e86df7
1 files changed, 8 insertions, 2 deletions
diff --git a/baserock-system-config-sync/baserock-system-config-sync b/baserock-system-config-sync/baserock-system-config-sync
index 8bc4790..7e02fc1 100755
--- a/baserock-system-config-sync/baserock-system-config-sync
+++ b/baserock-system-config-sync/baserock-system-config-sync
@@ -107,8 +107,14 @@ merge() {
if [ -h "$vu" -a -h "$v1" ]; then
if [ "$(readlink $v1)" == "$(readlink $vu)" ]; then
# User hasn't overriden the old v1 value: switch
- # to v2.
- cp -a "$v2" "$vt"
+ # to v2 if possible, or to vu if v2 doesn't have the
+ # symlink (This behaivour tries to be consistent with
+ # the table in 'merge_regular_file').
+ if [ -e "$v2" ]; then
+ cp -a "$v2" "$vt"
+ else
+ cp -a "$vu" "$vt"
+ fi
# User overwrote the v1 value; keep what they did
cp -a "$vu" "$vt"