From aba23668406b06d682715461f92641805ab88d98 Mon Sep 17 00:00:00 2001 From: Ben Brown Date: Wed, 13 Nov 2013 17:32:35 +0000 Subject: Removed 'local' from variables that are not within functions --- baserock-system-config-sync/baserock-system-config-sync | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/baserock-system-config-sync/baserock-system-config-sync b/baserock-system-config-sync/baserock-system-config-sync index 9b00625..b17c8d0 100755 --- a/baserock-system-config-sync/baserock-system-config-sync +++ b/baserock-system-config-sync/baserock-system-config-sync @@ -176,17 +176,17 @@ if [ "$1" = "merge" ]; then if [ "$#" != 2 ]; then usage "$0" fi - local new_version="$2" - local mounting_point=$(mktemp -d) + new_version="$2" + mounting_point=$(mktemp -d) "$mounting_script" "$mounting_point" if [ ! -d "$mounting_point/systems/$new_version" ]; then "$unmount" "$mounting_point" die "Error: version not found - '$new_version'" fi - local v1_dir="$mounting_point/systems/default/orig/etc" - local vu_dir="$mounting_point/systems/default/run/etc" - local v2_dir="$mounting_point/systems/$new_version/run/etc" - local vt_dir="$mounting_point/systems/$new_version/run/etc.new" + v1_dir="$mounting_point/systems/default/orig/etc" + vu_dir="$mounting_point/systems/default/run/etc" + v2_dir="$mounting_point/systems/$new_version/run/etc" + vt_dir="$mounting_point/systems/$new_version/run/etc.new" mkdir "$vt_dir" trap 'rm -rvf "$vt_dir"; "$unmount" "$mounting_point"' EXIT # For every pathname in V1, Vuser, or V2 @@ -197,8 +197,8 @@ if [ "$1" = "merge" ]; then rm -rf "$v2_dir" mv "$vt_dir" "$v2_dir" elif [ "$1" = "sync" ]; then - local canonical_version="$2" - local mounting_point=$(mktemp -d) + canonical_version="$2" + mounting_point=$(mktemp -d) "$mounting_script" "$mounting_point" trap '"$unmount" "$mounting_point"' EXIT if [ ! -d "$mounting_point/systems/$canonical_version" ]; then -- cgit v1.2.1 From 44c52debfb8bc27a78e4159fff30ac6e716c9518 Mon Sep 17 00:00:00 2001 From: Ben Brown Date: Mon, 6 Jan 2014 13:06:26 +0000 Subject: Add options to diff command to change header content to only include file name, and explicitly ask for a unified diff --- baserock-system-config-sync/baserock-system-config-sync | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/baserock-system-config-sync/baserock-system-config-sync b/baserock-system-config-sync/baserock-system-config-sync index b17c8d0..cb5984d 100755 --- a/baserock-system-config-sync/baserock-system-config-sync +++ b/baserock-system-config-sync/baserock-system-config-sync @@ -151,12 +151,12 @@ merge_regular_file() { cp -a "$vu" "$vt" ;; 'none exists exists') - if ! (diff "$v2" "$vu" | patch "$v2" -t -o "$vt"); then + if ! (diff -u "$v2" --label="$v2" "$vu" --label="$vu" | patch "$v2" -t -o "$vt"); then cp -a "$v2" "$vt" # merge failed, use v2 fi ;; 'exists exists exists') - if ! (diff "$v1" "$vu" | patch "$v2" -t -o "$vt"); then + if ! (diff -u "$v1" --label="$v1" "$vu" --label="$vu" | patch "$v2" -t -o "$vt"); then cp -a "$v2" "$vt" # merge failed, use v2 fi ;; -- cgit v1.2.1