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-02-26 14:23:10 +0000
commit7ac781919ae61cfc66bc277edaa34749310b3fee (patch)
tree162ea1116a3be1c12c689f0ccb49a19e1528a6a0
parent1a50b0ad73c809fd850498fc1a7131559f2f29ec (diff)
downloadtbdiff-7ac781919ae61cfc66bc277edaa34749310b3fee.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-xsystem-version-manager/system-version-manager3
-rwxr-xr-xtests/run_tests.sh4
3 files changed, 10 insertions, 8 deletions
diff --git a/baserock-system-config-sync/baserock-system-config-sync b/baserock-system-config-sync/baserock-system-config-sync
index 4631ad4..e4b4e10 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/system-version-manager/system-version-manager b/system-version-manager/system-version-manager
index 8769c90..914138f 100755
--- a/system-version-manager/system-version-manager
+++ b/system-version-manager/system-version-manager
@@ -132,7 +132,8 @@ class SystemVersionManager(object):
with open(log, 'w') as f:
subprocess.check_call(
- ['baserock-system-config-sync', 'merge', label],
+ ['baserock-system-config-sync',
+ 'merge', self.current_system, label],
stdout=f)
self.status(msg="Installing the kernel")
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 102aea6..a445733 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