launcher: fix creation of snap2

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).
This commit is contained in:
Pierre de La Morinerie 2017-10-23 19:29:15 +05:30
parent a3453177f0
commit c920e3d5f3

View file

@ -84,7 +84,7 @@ create_temp_backup () {
# lxc always creates the first snapshot it can creates. # 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. # 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 then
# Rename snap1 to snap2 # Rename snap1 to snap2
sudo mv "$snapshot_path/snap1" "$snapshot_path/snap2" sudo mv "$snapshot_path/snap1" "$snapshot_path/snap2"