summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhellekin <hellekin@dyne.org>2014-12-27 11:13:15 (GMT)
committer hellekin <hellekin@dyne.org>2014-12-27 11:13:15 (GMT)
commit1068033e932dc0e06650b7bb7feec3c4defa465a (patch)
treee2d403edd7f5348dd5761569e7a8aff968938510
parent45c5b53cc46043c2632a09a7f364f8eac765a287 (diff)
Address non-zero exit code on mount attemptfix_181
-rwxr-xr-xtomb17
1 files changed, 16 insertions, 1 deletions
diff --git a/tomb b/tomb
index 46f823d..f09bf2c 100755
--- a/tomb
+++ b/tomb
@@ -1753,9 +1753,24 @@ mount_tomb() {
sudo mkdir -p $tombmount
# Default mount options are overridden with the -o switch
- { option_is_set -o } && MOUNTOPTS="$(option_value -o)"
+ { option_is_set -o } && {
+ local oldmountopts=$MOUNTOPTS
+ MOUNTOPTS="$(option_value -o)" }
+ # TODO: safety check MOUNTOPTS
+ # safe_mount_options && \
sudo mount -o $MOUNTOPTS /dev/mapper/${mapper} ${tombmount}
+ # Clean up if the mount failed
+ [[ $? == 0 ]] || {
+ _warning "Error mounting ::1 mapper:: on ::2 tombmount::" $mapper $tombmount
+ [[ $oldmountopts != $MOUNTOPTS ]] && \
+ _warning "Are mount options '::1 mount options::' valid?" $MOUNTOPTS
+ # TODO: move cleanup to _endgame()
+ [[ -d $tombmount ]] && rmdir $tombmount
+ [[ -e /dev/mapper/$mapper ]] && sudo cryptsetup luksClose $mapper
+ # The loop is taken care of in _endgame()
+ _failure "Cannot mount ::1 tomb name::" $TOMBNAME
+ }
sudo chown $UID:$GID ${tombmount}
sudo chmod 0711 ${tombmount}