2
0
Fork 0
main
Ducky 2023-08-22 22:01:09 +01:00
parent 3181e9564f
commit 2402a4b42d
1 changed files with 7 additions and 4 deletions

View File

@ -304,15 +304,18 @@ elif [[ "$1" == "rescue" ]]; then
--target "/srv/dumps/$host/restic/$snapshot" \
"$snapshot"
elif [[ "$1" == "toggle-mount" ]]; then
mkdir -p "$restic_mount_path"
test_restic_mount="$(mountpoint "$restic_mount_path")"
function test_restic_mount() {
mountpoint "$restic_mount_path" &>/dev/null
echo $?
}
if [[ $? == 0 ]]; then
mkdir -p "$restic_mount_path"
if [[ $(test_restic_mount) == 0 ]]; then
say info "Unmounting: $restic_mount_path"
umount "$restic_mount_path"
if [[ $? == 0 ]]; then
say warning "Deleting: $restic_mount_path"
rm -rf "$restic_mount_path"
else
die "Failed to umount (are you still in '$restic_mount_path'?)"