aboutsummaryrefslogtreecommitdiff
path: root/firejail/firejail-refresh-links
blob: 2d4440d509f1f8799c9f6c0be871200db72774ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
#
# Refresh local firejail symlinks
#

# Parameters
BASENAME="`basename $0`"
DIRNAME="`dirname $0`"
PATTERN=""

# Ensure we are in the right folder
cd $DIRNAME

# Add global folder
if [ -d "/etc/firejail" ]; then
  PATTERN="$PATTERN /etc/firejail/*profile"
fi

# Add local folder
if [ -d "$HOME/.config/firejail" ]; then
  PATTERN="$PATTERN $HOME/.config/firejail/*profile"
fi

if [ ! -z "$PATTERN" ]; then
  ls -1 $PATTERN | \
    sed -e 's|/etc/firejail/||g' -e "s|$HOME/.config/firejail/||g" -e 's/.profile$//' | sort | uniq | while read profile; do
  if which $profile &> /dev/null; then
    if [ ! -h "$profile" ]; then
      ln -s /usr/bin/firejail $profile
    fi
  fi
done
fi