Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mount option override checkbox #682

Merged
merged 6 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/vorta/assets/UI/archivetab.ui
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="overrideMountOpts">
<property name="text">
<string>Override mount permissions</string>
</property>
<property name="toolTip">
<string>Tick this box if there are permission errors on the mounted archive</string>
m3nu marked this conversation as resolved.
Show resolved Hide resolved
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="mountErrors">
<property name="enabled">
Expand Down
9 changes: 6 additions & 3 deletions src/vorta/borg/mount.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
from os import getuid
from .borg_thread import BorgThread


Expand All @@ -8,14 +8,17 @@ def started_event(self):
self.updated.emit(self.tr('Mounting archive into folder...'))

@classmethod
def prepare(cls, profile):
def prepare(cls, profile, override_mount_opts):
ret = super().prepare(profile)
if not ret['ok']:
return ret
else:
ret['ok'] = False # Set back to false, so we can do our own checks here.

cmd = ['borg', '--log-json', 'mount', '-o', f"umask=0277,uid={os.getuid()}", f"{profile.repo.url}"]
cmd = ['borg', '--log-json', 'mount', f"{profile.repo.url}"]

if override_mount_opts:
cmd[3:3] = ['-o', f"umask=0277,uid={getuid()}"]

ret['ok'] = True
ret['cmd'] = cmd
Expand Down
2 changes: 1 addition & 1 deletion src/vorta/views/archive_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def set_mount_button_mode(self, mode):

def mount_action(self):
profile = self.profile()
params = BorgMountThread.prepare(profile)
params = BorgMountThread.prepare(profile, self.overrideMountOpts.isChecked())
if not params['ok']:
self._set_status(params['message'])
return
Expand Down