mirror of
https://github.com/Llewellynvdm/Tomb.git
synced 2024-11-26 06:46:30 +00:00
Prevent directory removals if tomb didn't create them
This commit is contained in:
parent
7756dc1610
commit
f408017c07
8
src/tomb
8
src/tomb
@ -570,7 +570,9 @@ mount_tomb() {
|
|||||||
notice "mounting $tombfile on mountpoint $tombmount"
|
notice "mounting $tombfile on mountpoint $tombmount"
|
||||||
|
|
||||||
# we need root from here on
|
# we need root from here on
|
||||||
mkdir -p $tombmount
|
|
||||||
|
local norm=$(test -d $tombmount)
|
||||||
|
$norm || mkdir -p $tombmount
|
||||||
|
|
||||||
nstloop=`losetup -f`
|
nstloop=`losetup -f`
|
||||||
losetup -f ${tombfile}
|
losetup -f ${tombfile}
|
||||||
@ -580,7 +582,7 @@ mount_tomb() {
|
|||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
# is it a LUKS encrypted nest? see cryptsetup(1)
|
# is it a LUKS encrypted nest? see cryptsetup(1)
|
||||||
error "$tombfile is not a valid Luks encrypted storage file"
|
error "$tombfile is not a valid Luks encrypted storage file"
|
||||||
rmdir $tombmount 2>/dev/null
|
$norm || rmdir $tombmount 2>/dev/null
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -624,7 +626,7 @@ mount_tomb() {
|
|||||||
if ! [ -r /dev/mapper/${mapper} ]; then
|
if ! [ -r /dev/mapper/${mapper} ]; then
|
||||||
error "failure mounting the encrypted file"
|
error "failure mounting the encrypted file"
|
||||||
losetup -d ${nstloop}
|
losetup -d ${nstloop}
|
||||||
rmdir ${tombmount} 2>/dev/null
|
$norm || rmdir ${tombmount} 2>/dev/null
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user