Merge pull request #35 from kemenaran/fix-snap2-creation

launcher: fix creation of snap2
This commit is contained in:
Maniack Crudelis 2017-11-12 22:50:24 +01:00 committed by GitHub
commit 1487919656
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -78,13 +78,13 @@ create_temp_backup () {
# Check if the snapshot already exist # Check if the snapshot already exist
if [ ! -e "$snapshot_path/snap$snap_number" ] if [ ! -e "$snapshot_path/snap$snap_number" ]
then then
echo "snap$snap_number doesn't exist, its first creation can be take a little while." >&2 echo "snap$snap_number doesn't exist, its first creation can takes a little while." >&2
# Create the snapshot. # Create the snapshot.
sudo lxc-snapshot --name $lxc_name >> "$test_result" 2>&1 sudo lxc-snapshot --name $lxc_name >> "$test_result" 2>&1
# 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"