Skip to content

Commit

Permalink
Handling already mounted persistence backing media correctly.
Browse files Browse the repository at this point in the history
I.e. treat the case where a backing media already had been mounted in
the expected place like a success (by printing the mount dir). This
doesn't fix any bug in live-boot, but it will come in handy for the
(soon-to-come) script for activating custom persistence in user-space.

While we're at it, document this function.
  • Loading branch information
Tails developers authored and daniel-baumann committed May 6, 2013
1 parent 63a94b2 commit 0c19af3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scripts/boot/9990-misc-helpers.sh
Expand Up @@ -714,6 +714,11 @@ try_mount ()
fi
}

# Try to mount $device to the place expected by live-boot. If $device
# is already mounted somewhere, move it to the expected place. If
# we're only probing $device (to check if it has custom persistence)
# $probe should be set, which suppresses warnings upon failure. On
# success, print the mount point for $device.
mount_persistence_media ()
{
local device=${1}
Expand Down Expand Up @@ -751,8 +756,12 @@ mount_persistence_media ()
rmdir "${backing}"
return 1
fi
else
# This means that $device has already been mounted on
# the place expected by live-boot, so we're done.
echo ${backing}
return 0
fi
return 0
}

close_persistence_media ()
Expand Down

0 comments on commit 0c19af3

Please sign in to comment.