From 015ab144cce556811a5953cf412050571b17b96a Mon Sep 17 00:00:00 2001 From: Florian Begusch Date: Thu, 3 Jun 2021 08:30:21 +0200 Subject: jail_prober: enable absolut include directives --- contrib/jail_prober.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/contrib/jail_prober.py b/contrib/jail_prober.py index 9205d9b3e..95e299624 100755 --- a/contrib/jail_prober.py +++ b/contrib/jail_prober.py @@ -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 @@ -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 -- cgit v1.2.3-54-g00ecf