aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorLibravatar rusty-snake <41237666+rusty-snake@users.noreply.github.com>2021-07-07 12:00:20 +0200
committerLibravatar rusty-snake <41237666+rusty-snake@users.noreply.github.com>2021-07-07 12:00:20 +0200
commited02ab57b0e25047aca976b30ced64f94ff9c49a (patch)
tree405269fcc2a73705691afd0baa67d8cec80189d6 /src/tools
parentallow/deny fbuilder (diff)
downloadfirejail-ed02ab57b0e25047aca976b30ced64f94ff9c49a.tar.gz
firejail-ed02ab57b0e25047aca976b30ced64f94ff9c49a.tar.zst
firejail-ed02ab57b0e25047aca976b30ced64f94ff9c49a.zip
Create profcleaner.sh
profcleaner.c is just sed, I was wondering why we need C for that.
Diffstat (limited to 'src/tools')
-rwxr-xr-xsrc/tools/profcleaner.sh45
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..4f6ca88f5
--- /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
21if [[ $1 == --help ]]; then
22 cat <<-EOM
23 USAGE:
24 profcleaner.sh --help Show this help message and exit
25 profcleaner.sh --all 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
30fi
31
32if [[ $1 == --all ]]; then
33 profiles=(/etc/firejail/*.{inc,local,profile})
34elif [[ $1 == --user ]]; then
35 profiles=("$HOME"/.config/firejail/*.{inc,local,profile})
36else
37 profiles=("$@")
38fi
39
40sed -i \
41 -e "s/^blacklist/deny/" \
42 -e "s/^noblacklist/nodeny/" \
43 -e "s/^whitelist/allow/" \
44 -e "s/^nowhitelist/noallow/" \
45 "${profiles[@]}"