From c920e3d5f38efd571efd84ea0f2ed80ba5fb60a8 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 23 Oct 2017 19:29:15 +0530 Subject: [PATCH] launcher: fix creation of snap2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When snap1 doesn't exist, `lxc-snapshot` will create a snapshot named `snap1` (instead of `snap2`). In this case we need to rename snap1 into snap2. However the condition check is wrong: after creating the snapshot, `snap1` will *always* exist – even if it didn't before. Thus the renaming never happens. Fix the issue by detecting the absence of snap2 (rather than snap1). --- sub_scripts/launcher.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sub_scripts/launcher.sh b/sub_scripts/launcher.sh index 1b14842..25a001f 100755 --- a/sub_scripts/launcher.sh +++ b/sub_scripts/launcher.sh @@ -84,7 +84,7 @@ create_temp_backup () { # lxc always creates the first snapshot it can creates. # So if snap1 doesn't exist and you try to create snap2, it will be named snap1. - if [ "$snap_number" == "2" ] && [ ! -e "$snapshot_path/snap1" ] + if [ "$snap_number" == "2" ] && [ ! -e "$snapshot_path/snap2" ] then # Rename snap1 to snap2 sudo mv "$snapshot_path/snap1" "$snapshot_path/snap2"