From 115c838376b7ef67913542827a65b54e80d8c6c6 Mon Sep 17 00:00:00 2001 From: Wolfgang Link Date: Thu, 3 Sep 2015 08:52:16 +0200 Subject: [PATCH] This function checks if a moutpoint is mounted --- src/PVE/ProcFSTools.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm index fea539a..4670694 100644 --- a/src/PVE/ProcFSTools.pm +++ b/src/PVE/ProcFSTools.pm @@ -288,6 +288,18 @@ sub read_proc_mounts { return PVE::Tools::file_get_contents("/proc/mounts"); } +sub is_mounted { + my ($mountpoint) = @_; + + my $mountdata = read_proc_mounts(); + + if ($mountdata =~ m/\s$mountpoint\s/) { + return 1; + } else { + return 0; + } +} + sub read_proc_net_ipv6_route { my $filename = "/proc/net/ipv6_route"; -- 2.39.2