Closed Blu-Shield closed 4 years ago
I also ran into this. After asking about this on #flatpak, it was suggested to use an "override" to add a permanent setting to an application to allow access to a different mount point. For example:
flatpak override --user --filesystem=/my-mount com.makemkv.MakeMKV
That being said, if there's a better and more generic way to do this via FileChooser portal where the user didn't have to configuring anything extra, it's worth looking into.
I'm a little hesitant to use some hard coded mount points if a more generic mechanism can be used, but maybe there's no harm in adding a bunch of defaults.
I couldn't get the flatpak override to work at all with my external drive mounted under /mnt/hdd, I just had to end up using workaround by mounting the external drive somewhere under /home, in my case my external drive is really just my secondary HDD (non-SSD) so I mounted it as /home/hdd. That finally allowed me to use it from MakeMKV installed via snap on Linux Mint.
Currently, the only filesystems that the MakeMKV Flatpak is allowed to access are /home and optical drives. You can see the filesystem permissions in com.makemkv.MakeMKV.json:
There are use cases in which it may not be acceptable for the user to save their rips in their /home directory. For example, my /home directory is on a small SSD, and I wouldn't be able to fit the contents of a dual-layer Blu-ray (let alone a 3D Blu-ray or UltraHD Blu-ray) in my /home directory. I normally configure space-intensive applications to save their large files either to my internal HDD, or to an external HDD. But the MakeMKV Flatpak can't access either the internal or external HDD, due to lack of permissions.
I can see 2 ways of fixing this (note: I don't have any prior experience with Flatpak development, other than following bug reports, so some of my example code may be wrong):
Grant MakeMKV raw access to all mounted partitions
This is probably the quickest and easiest solution, but less secure. I assume adding "--filesystem=/media", "--filesystem=/mnt", "--filesystem=/run/media" and "--filesystem=/run/mount" would cover the default mount points of almost all Linux distros.
Using the FileChooser portal, allow the user to grant MakeMKV access to a folder at runtime
This is the more secure option, as you wouldn't need to grant MakeMKV raw access to any directories (not even /home). MakeMKV would then default to saving its configuration files and dumps to a location within the sandbox, and its rips to another location within the sandbox. However, the user could change these locations to whatever suits them, by changing the "MakeMKV data directory" and "Output folder", respectively.
I know that KeePassXC (which also depends on the KDE runtime) has been using FileChooser for a while (see https://github.com/flathub/org.keepassxc.KeePassXC/issues/2 for evidence of this); as such, it might be useful to study how the KeePassXC Flatpak works.