]> gitweb.fluxo.info Git - rhatto/apps.git/commitdiff
Handle also custom firejail profiles att firejail-refresh-links
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 16 Sep 2017 19:23:09 +0000 (16:23 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 16 Sep 2017 19:23:09 +0000 (16:23 -0300)
firejail/firejail-refresh-links

index 627965b758de0e0aa5c9b66c2ed53e4f4b8d5bf1..2d4440d509f1f8799c9f6c0be871200db72774ce 100755 (executable)
@@ -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