backups: remove validation mount point after testing it

this also moves out the attempt validation logic from mounts code
into volumes. mounts.tryAddMount is also used in backup code
This commit is contained in:
Girish Ramakrishnan
2023-09-29 06:49:55 +05:30
parent 8d0abf214c
commit 64381e2a04
5 changed files with 59 additions and 62 deletions

View File

@@ -28,7 +28,7 @@ mount_file="/etc/systemd/system/${mount_filename}"
# cleanup any previous mount of same name (after midway box crash?)
if systemctl -q is-active "${mount_filename}"; then
echo "Previous mount active, unmounting"
echo "Previous mount ${mount_filename} active, unmounting"
# unmounting can fail if a user is cd'ed into the directory. if we go ahead and mount anyway, systemd says "active" because it's referring to the previous mount config
if ! systemctl stop "${mount_filename}"; then
echo "Failed to unmount"
@@ -45,7 +45,7 @@ if ! timeout "${timeout}" systemctl enable --now "${mount_filename}"; then
exit 3
fi
echo "Mount succeeded"
echo "Mount ${mount_filename} succeeded"
# this has to be done post-mount because permissions come from the underlying mount file system and not the mount point
chmod 777 "${where}"