Skip to content

Commit b229c20

Browse files
committed
AppImage Firejail: make '-t file:help' run
(help for usage, not a regular file)
1 parent 785a05e commit b229c20

File tree

1 file changed

+8
-2
lines changed
  • data/scripts/Linux-AppImage

1 file changed

+8
-2
lines changed

data/scripts/Linux-AppImage/AppRun

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,11 @@ add_whitelist() {
272272
path"$HOME${1#\~}"
273273
fi
274274

275+
# if the path doesn't exist, whitelist will fail, solves eg. "file:help"
276+
if [ ! -e "$path" ]; then
277+
return
278+
fi
279+
275280
if contains_mount "$path"; then
276281
disable_mount=no
277282
fi
@@ -300,12 +305,13 @@ whitelist_file_path() {
300305
fi
301306
if expr "$n" : '.*file[:=]' >/dev/null || expr "$n" : '.*filename' \
302307
>/dev/null; then
303-
parent_dir=$(dirname "path")
308+
fullpath=$(realpath "path")
309+
parent_dir=$(dirname "$fullpath")
304310
if [ "$parent_dir" = /dev ] || [ "$parent_dir" = /tmp ]; then
305311
return
306312
fi
307313
# whitelist the parent folder to allow file creation
308-
printf -- "$separator--whitelist=\"%s\"" "$parent_dir"
314+
add_whitelist "$parent_dir"
309315
fi
310316
}
311317

0 commit comments

Comments
 (0)