diff options
author | Florian Begusch <florian.begusch@gmail.com> | 2021-06-03 08:30:21 +0200 |
---|---|---|
committer | Florian Begusch <florian.begusch@gmail.com> | 2021-06-03 08:30:21 +0200 |
commit | 015ab144cce556811a5953cf412050571b17b96a (patch) | |
tree | 6813a3183afa05cbd8465e73051b107402c472f6 | |
parent | version 0.9.66rc1 released (diff) | |
download | firejail-015ab144cce556811a5953cf412050571b17b96a.tar.gz firejail-015ab144cce556811a5953cf412050571b17b96a.tar.zst firejail-015ab144cce556811a5953cf412050571b17b96a.zip |
jail_prober: enable absolut include directives
-rwxr-xr-x | contrib/jail_prober.py | 20 |
1 files 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): | |||
70 | return profile | 70 | return profile |
71 | 71 | ||
72 | 72 | ||
73 | def absolute_include(word): | ||
74 | home = os.environ['HOME'] | ||
75 | path = home + '/.config/firejail/' | ||
76 | |||
77 | option, filename = word.split('=') | ||
78 | absolute_filename = path + filename | ||
79 | |||
80 | if not os.path.isfile(absolute_filename): | ||
81 | absolute_filename = '${CFG}/' + filename | ||
82 | |||
83 | return option + '=' + absolute_filename | ||
84 | |||
85 | |||
73 | def arg_converter(arg_list, style): | 86 | def arg_converter(arg_list, style): |
74 | """ | 87 | """ |
75 | Convert between firejail command-line arguments (--example=something) and | 88 | Convert between firejail command-line arguments (--example=something) and |
@@ -94,9 +107,12 @@ def arg_converter(arg_list, style): | |||
94 | if style == 'to_profile': | 107 | if style == 'to_profile': |
95 | new_args = [word[2:] for word in new_args] | 108 | new_args = [word[2:] for word in new_args] |
96 | 109 | ||
97 | # Remove invalid '--include' args if converting to command-line form | ||
98 | elif style == 'to_commandline': | 110 | elif style == 'to_commandline': |
99 | new_args = [word for word in new_args if 'include' not in word] | 111 | new_args = [ |
112 | absolute_include(word) if word.startswith('--include') | ||
113 | else word | ||
114 | for word in new_args | ||
115 | ] | ||
100 | 116 | ||
101 | return new_args | 117 | return new_args |
102 | 118 | ||