Skip to content

Commit

Permalink
jail_prober: enable absolut include directives
Browse files Browse the repository at this point in the history
  • Loading branch information
diepfote committed Jun 3, 2021
1 parent 4522ccb commit 015ab14
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions contrib/jail_prober.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ def get_args(profile_path):
return profile


def absolute_include(word):
home = os.environ['HOME']
path = home + '/.config/firejail/'

option, filename = word.split('=')
absolute_filename = path + filename

if not os.path.isfile(absolute_filename):
absolute_filename = '${CFG}/' + filename

return option + '=' + absolute_filename


def arg_converter(arg_list, style):
"""
Convert between firejail command-line arguments (--example=something) and
Expand All @@ -94,9 +107,12 @@ def arg_converter(arg_list, style):
if style == 'to_profile':
new_args = [word[2:] for word in new_args]

# Remove invalid '--include' args if converting to command-line form
elif style == 'to_commandline':
new_args = [word for word in new_args if 'include' not in word]
new_args = [
absolute_include(word) if word.startswith('--include')
else word
for word in new_args
]

return new_args

Expand Down

0 comments on commit 015ab14

Please sign in to comment.