diff options
author | rusty-snake <41237666+rusty-snake@users.noreply.github.com> | 2021-06-04 05:56:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-04 05:56:53 +0000 |
commit | d371aae0814d6910fe2c92022e2a6ae5d402cca7 (patch) | |
tree | 994b706262a950104eb1f39a7ee3f2dfd24fbb99 | |
parent | some profile fixes for Debian 10 (diff) | |
parent | jail_prober: enable absolut include directives (diff) | |
download | firejail-d371aae0814d6910fe2c92022e2a6ae5d402cca7.tar.gz firejail-d371aae0814d6910fe2c92022e2a6ae5d402cca7.tar.zst firejail-d371aae0814d6910fe2c92022e2a6ae5d402cca7.zip |
Merge pull request #4325 from florianbegusch/fbegusch-improve-jail_prober.py
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 | ||