borg
borg copied to clipboard
Feature Request - List borgfs mounts
borg mount
In addition to displaying help and usage for the mount command, borg mount can list the currently mounted borg filesystems.
Here is shell command which produces clean output:
mount | grep borgfs | sed -e 's/borgfs on \(.*\) type.*/\1/'
output would be:
/mount/your-mount-point
Here is a python one-liner which does the same without requiring any new imports to archiver.py:
print(re.sub(r".*borgfs (.*) fuse ro,.*", "\\1", "\n".join(s for s in open('/proc/mounts').read().split('\n') if 'borgfs' in s)))
If interested I can clean up the one-liner and create a PR. Since this just reads /proc/mounts, this won't work with Windows (not sure about cygwin).
This is easy to test in python shell:
import re
print(re.sub(r".*borgfs (.*) fuse ro,.*", "\\1", "\n".join(s for s in open('/proc/mounts').read().split('\n') if 'borgfs' in s)))
Good idea.
A slight problem here might be portability - this should work on all platforms where we support FUSE:
- linux
- freebsd
- macOS
For the PR: please no one-liners, but rather well readable code.
For the PR: please no one-liners, but rather well readable code.
Ofc. :)
There is no /proc/mounts on FreeBSD unless you have Linux compatibility loaded, in which case it exists as /compat/linux/proc/mounts
I don't have experience with MacOS, but I'm sure it doesn't have /proc at all.