aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/sort.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/contrib/sort.py b/contrib/sort.py
index 69af99d6e..b4e06d345 100755
--- a/contrib/sort.py
+++ b/contrib/sort.py
@@ -3,11 +3,17 @@
3# Copyright (C) 2014-2022 Firejail Authors 3# Copyright (C) 2014-2022 Firejail Authors
4# License GPL v2 4# License GPL v2
5""" 5"""
6Sort the items of multi-item options in profiles, the following options are supported: 6Sort the arguments of commands in profiles.
7 private-bin, private-etc, private-lib, caps.drop, caps.keep, seccomp.drop, seccomp.drop, protocol 7
8Usage: ./sort.py [/path/to/profile ...]
9
10The following commands are supported:
11
12 private-bin, private-etc, private-lib, caps.drop, caps.keep, seccomp.drop,
13 seccomp.drop, protocol
14
15Note that this is only applicable to commands that support multiple arguments.
8 16
9Usage:
10 $ ./sort.py /path/to/profile [ /path/to/profile2 /path/to/profile3 ... ]
11Keep in mind that this will overwrite your profile(s). 17Keep in mind that this will overwrite your profile(s).
12 18
13Examples: 19Examples:
@@ -16,10 +22,10 @@ Examples:
16 $ ./sort.py ~/.config/firejail/*.{profile,inc,local} 22 $ ./sort.py ~/.config/firejail/*.{profile,inc,local}
17 $ sudo ./sort.py /etc/firejail/*.{profile,inc,local} 23 $ sudo ./sort.py /etc/firejail/*.{profile,inc,local}
18 24
19Exit-Codes: 25Exit Codes:
20 0: No Error; No Profile Fixed. 26 0: Success: No profiles needed fixing.
21 1: Error, one or more profiles were not processed correctly. 27 1: Error: One or more profiles could not be processed correctly.
22 101: No Error; One or more profile were fixed. 28 101: Info: One or more profiles were fixed.
23""" 29"""
24 30
25# Requirements: 31# Requirements:
@@ -34,7 +40,11 @@ def sort_alphabetical(original_items):
34 40
35 41
36def sort_protocol(original_protocols): 42def sort_protocol(original_protocols):
37 """sort the given protocols into this scheme: unix,inet,inet6,netlink,packet,bluetooth""" 43 """
44 Sort the given protocols into the following order:
45
46 unix,inet,inet6,netlink,packet,bluetooth
47 """
38 48
39 # shortcut for common protocol lines 49 # shortcut for common protocol lines
40 if original_protocols in ("unix", "unix,inet,inet6"): 50 if original_protocols in ("unix", "unix,inet,inet6"):