[3/3] extrahd: Do not try to umount if nothing is mounted

Message ID 20230802091415.3168597-3-michael.tremer@ipfire.org
State Staged
Commit 88513c0ef56c0bba4e074d15c49b19af74016c86
Headers
Series [1/3] extrahd: Rewrite the mount script in shell |

Commit Message

Michael Tremer Aug. 2, 2023, 9:14 a.m. UTC
  Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 config/extrahd/extrahd.pl | 5 +++++
 1 file changed, 5 insertions(+)
  

Patch

diff --git a/config/extrahd/extrahd.pl b/config/extrahd/extrahd.pl
index eba3f9b37..145a2a43a 100644
--- a/config/extrahd/extrahd.pl
+++ b/config/extrahd/extrahd.pl
@@ -80,6 +80,11 @@  extrahd_umount() {
 			continue
 		fi
 
+		# Do not try to umount if nothing is mounted
+		if ! mountpoint "${mountpoint}" &>/dev/null; then
+			continue
+		fi
+
 		# Umount and try lazy umount if failed
 		if umount --quiet --recursive "${mountpoint}" || \
 				umount --quiet --recursive --lazy "${mountpoint}"; then