aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfirejail/firejail-refresh-links25
1 files changed, 19 insertions, 6 deletions
diff --git a/firejail/firejail-refresh-links b/firejail/firejail-refresh-links
index 627965b..2d4440d 100755
--- a/firejail/firejail-refresh-links
+++ b/firejail/firejail-refresh-links
@@ -6,15 +6,28 @@
# Parameters
BASENAME="`basename $0`"
DIRNAME="`dirname $0`"
+PATTERN=""
# Ensure we are in the right folder
cd $DIRNAME
-ls -1 /etc/firejail/*profile | \
- sed -e 's|/etc/firejail/||g' -e 's/.profile$//' | while read profile; do
- if which $profile &> /dev/null; then
- if [ ! -h "$profile" ]; then
- ln -s /usr/bin/firejail $profile
- fi
+# 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