fixing already mounted checks

This commit is contained in:
Ville Rantanen
2023-01-02 08:37:45 +02:00
parent 6b24386b42
commit c06abacd38
2 changed files with 6 additions and 4 deletions

View File

@@ -44,7 +44,7 @@ _askpass() {
} }
_check_mount() { _check_mount() {
if [[ -d "$valid_name" ]]; then if [[ -d ~/mnt/"$valid_name" ]]; then
device1=$( stat -c "%d" ~/mnt/"$valid_name" ) device1=$( stat -c "%d" ~/mnt/"$valid_name" )
device2=$( stat -c "%d" ~/mnt ) device2=$( stat -c "%d" ~/mnt )
else else
@@ -73,6 +73,7 @@ valid_name=$( echo "${remote%:}" | sed -e 's/:/-/g' | sed -e 's/[^A-Za-z0-9._@-]
if [[ "$unmount" = true ]]; then if [[ "$unmount" = true ]]; then
cd ~/mnt cd ~/mnt
if [[ -n "$remote" ]]; then if [[ -n "$remote" ]]; then
echo Unmounting ~/mnt/$valid_name
fusermount -u -z ~/mnt/$valid_name fusermount -u -z ~/mnt/$valid_name
rmdir --ignore-fail-on-non-empty ~/mnt/$valid_name &>/dev/null rmdir --ignore-fail-on-non-empty ~/mnt/$valid_name &>/dev/null
else else

View File

@@ -60,6 +60,7 @@ fi
if [[ "$unmount" = true ]]; then if [[ "$unmount" = true ]]; then
cd ~/mnt cd ~/mnt
if [[ -n "$host" ]]; then if [[ -n "$host" ]]; then
echo Unmounting ~/mnt/$valid_name
fusermount -u -z ~/mnt/$valid_name fusermount -u -z ~/mnt/$valid_name
rmdir --ignore-fail-on-non-empty ~/mnt/$valid_name &>/dev/null rmdir --ignore-fail-on-non-empty ~/mnt/$valid_name &>/dev/null
else else
@@ -78,9 +79,9 @@ if [[ -z "$host" ]]; then
_helpexit _helpexit
fi fi
if [[ -d "$valid_name" ]]; then if [[ -d ~/mnt/"$valid_name" ]]; then
device1=$( stat -c "%d" "$valid_name" ) device1=$( stat -c "%d" ~/mnt/"$valid_name" )
device2=$( stat -c "%d" . ) device2=$( stat -c "%d" ~/mnt/ )
else else
device1=valid device1=valid
device2=valid device2=valid