|
2 | 2 | # This file is part of Firejail project
|
3 | 3 | # Copyright (C) 2014-2022 Firejail Authors
|
4 | 4 | # License GPL v2
|
5 |
| -"""\ |
| 5 | + |
| 6 | +# Requirements: |
| 7 | +# python >= 3.6 |
| 8 | +from os import path |
| 9 | +from sys import argv, exit as sys_exit, stderr |
| 10 | + |
| 11 | +__doc__ = f"""\ |
6 | 12 | Sort the arguments of the commands that support multiple arguments in profiles;
|
7 | 13 | the following commands are supported:
|
8 | 14 |
|
9 | 15 | private-bin, private-etc, private-lib, caps.drop, caps.keep, seccomp.drop,
|
10 | 16 | seccomp.drop, protocol
|
11 | 17 |
|
12 |
| -Usage: ./sort.py [/path/to/profile ...] |
| 18 | +Usage: {path.basename(argv[0])} [/path/to/profile ...] |
13 | 19 |
|
14 | 20 | Keep in mind that this will overwrite your profile(s).
|
15 | 21 |
|
16 | 22 | Examples:
|
17 |
| - $ ./sort.py MyAwesomeProfile.profile |
18 |
| - $ ./sort.py new_profile.profile second_new_profile.profile |
19 |
| - $ ./sort.py ~/.config/firejail/*.{profile,inc,local} |
20 |
| - $ sudo ./sort.py /etc/firejail/*.{profile,inc,local} |
| 23 | + $ {argv[0]} MyAwesomeProfile.profile |
| 24 | + $ {argv[0]} new_profile.profile second_new_profile.profile |
| 25 | + $ {argv[0]} ~/.config/firejail/*.{{profile,inc,local}} |
| 26 | + $ sudo {argv[0]} /etc/firejail/*.{{profile,inc,local}} |
21 | 27 |
|
22 | 28 | Exit Codes:
|
23 | 29 | 0: Success: No profiles needed fixing.
|
24 | 30 | 1: Error: One or more profiles could not be processed correctly.
|
25 | 31 | 101: Info: One or more profile were fixed.
|
26 | 32 | """
|
27 | 33 |
|
28 |
| -# Requirements: |
29 |
| -# python >= 3.6 |
30 |
| -from sys import argv, exit as sys_exit, stderr |
31 |
| - |
32 | 34 |
|
33 | 35 | def sort_alphabetical(original_items):
|
34 | 36 | items = original_items.split(",")
|
|
0 commit comments