diff options
author | 2021-07-08 08:40:19 -0500 | |
---|---|---|
committer | 2021-07-08 08:40:19 -0500 | |
commit | 00cb8b611f0e35a56585061d689fbcca2af0566b (patch) | |
tree | b3ac5a3a2e82c2168f37baf8bd91fac5ebd0e49a /src/tools/profcleaner.sh | |
parent | Merge pull request #4388 from rusty-snake/allow-deny-zsh (diff) | |
parent | profcleaner.sh: Rename --all to --system (diff) | |
download | firejail-00cb8b611f0e35a56585061d689fbcca2af0566b.tar.gz firejail-00cb8b611f0e35a56585061d689fbcca2af0566b.tar.zst firejail-00cb8b611f0e35a56585061d689fbcca2af0566b.zip |
Merge pull request #4389 from rusty-snake/profcleaner.sh
Create profcleaner.sh
Diffstat (limited to 'src/tools/profcleaner.sh')
-rwxr-xr-x | src/tools/profcleaner.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/tools/profcleaner.sh b/src/tools/profcleaner.sh new file mode 100755 index 000000000..ded3313fa --- /dev/null +++ b/src/tools/profcleaner.sh | |||
@@ -0,0 +1,45 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # Copyright (C) 2021 Firejail Authors | ||
4 | # | ||
5 | # This file is part of firejail project | ||
6 | # | ||
7 | # This program is free software; you can redistribute it and/or modify | ||
8 | # it under the terms of the GNU General Public License as published by | ||
9 | # the Free Software Foundation; either version 2 of the License, or | ||
10 | # (at your option) any later version. | ||
11 | # | ||
12 | # This program is distributed in the hope that it will be useful, | ||
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | # GNU General Public License for more details. | ||
16 | # | ||
17 | # You should have received a copy of the GNU General Public License along | ||
18 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
20 | |||
21 | if [[ $1 == --help ]]; then | ||
22 | cat <<-EOM | ||
23 | USAGE: | ||
24 | profcleaner.sh --help Show this help message and exit | ||
25 | profcleaner.sh --system Clean all profiles in /etc/firejail | ||
26 | profcleaner.sh --user Clean all profiles in ~/.config/firejail | ||
27 | profcleaner.sh /path/to/profile1 /path/to/profile2 ... | ||
28 | EOM | ||
29 | exit 0 | ||
30 | fi | ||
31 | |||
32 | if [[ $1 == --system ]]; then | ||
33 | profiles=(/etc/firejail/*.{inc,local,profile}) | ||
34 | elif [[ $1 == --user ]]; then | ||
35 | profiles=("$HOME"/.config/firejail/*.{inc,local,profile}) | ||
36 | else | ||
37 | profiles=("$@") | ||
38 | fi | ||
39 | |||
40 | sed -i \ | ||
41 | -e "s/^blacklist/deny/" \ | ||
42 | -e "s/^noblacklist/nodeny/" \ | ||
43 | -e "s/^whitelist/allow/" \ | ||
44 | -e "s/^nowhitelist/noallow/" \ | ||
45 | "${profiles[@]}" | ||