summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-02-20 18:42:15 +0000
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2014-03-06 15:34:13 +0000
commit2c6259f156087e2b99d02666c5323d598aca9f45 (patch)
tree921cfda7f7a6c42c9321718031f339faf16f76c8
parentd8532bc2f93a80b5be8701955e668787be41ac3e (diff)
downloadtbdiff-2c6259f156087e2b99d02666c5323d598aca9f45.tar.gz
Modify 'baserock-system-config-sync' to get two arguments using 'merge'
Since with 'system-version-manager' is possible to change the default system, 'baserock-system-config-sync' shouldn't get the default system, and get an extra parameter to choose the system version to merge.
-rwxr-xr-xbaserock-system-config-sync/baserock-system-config-sync11
-rwxr-xr-xtests/run_tests.sh4
2 files changed, 8 insertions, 7 deletions
diff --git a/baserock-system-config-sync/baserock-system-config-sync b/baserock-system-config-sync/baserock-system-config-sync
index f21f898..7321a1b 100755
--- a/baserock-system-config-sync/baserock-system-config-sync
+++ b/baserock-system-config-sync/baserock-system-config-sync
@@ -23,7 +23,7 @@ set -eu
usage() {
- echo "Usage: $(basename $0) merge NEW_VERSION_LABEL" >&2
+ echo "Usage: $(basename $0) merge OLD_VERSION_LABEL NEW_VERSION_LABEL" >&2
echo " $(basename $0) sync CANONICAL_VERSION_LABEL" >&2
exit 1
}
@@ -187,18 +187,19 @@ fi
if [ "$1" = "merge" ]; then
- if [ "$#" != 2 ]; then
+ if [ "$#" != 3 ]; then
usage "$0"
fi
- new_version="$2"
+ old_version="$2"
+ new_version="$3"
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
- v1_dir="$mounting_point/systems/default/orig/etc"
- vu_dir="$mounting_point/systems/default/run/etc"
+ v1_dir="$mounting_point/systems/$old_version/orig/etc"
+ vu_dir="$mounting_point/systems/$old_version/run/etc"
v2_dir="$mounting_point/systems/$new_version/run/etc"
vt_dir="$mounting_point/systems/$new_version/run/etc.new"
mkdir "$vt_dir"
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 102aea6..d460bf7 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -53,7 +53,7 @@ for folder in "$merge_pass_folder/"*.in; do
TMPDIR=$(mktemp -d)
TMPDIR=$TMPDIR mounting_script="./fake_mounting_script.sh" unmount=true \
mounting_script_test_dir="$folder" "$bscs_script" "merge" \
- "version2" &>> "$bscs_log"
+ "default" "version2" &>> "$bscs_log"
exit_code="$?"
if [ "$exit_code" -ne 0 ]; then
echo ": FAILED (exit code "$exit_code")" 1>&2
@@ -75,7 +75,7 @@ for folder in "$merge_fail_folder/"*.in; do
TMPDIR=$(mktemp -d)
TMPDIR=$TMPDIR mounting_script="./fake_mounting_script.sh" unmount=true \
mounting_script_test_dir="$folder" "$bscs_script" "merge" \
- "version2" &>> "$bscs_log"
+ "default" "version2" &>> "$bscs_log"
if [ $? -eq 0 ]; then
echo ": FAILED" 1>&2
exit 1