Skip to content

Commit

Permalink
triggers: Quote more defensively
Browse files Browse the repository at this point in the history
In the unlikely event that one of these paths contains spaces or other
special characters, we don't want to field splitting to take place.

Signed-off-by: Simon McVittie <[email protected]>
  • Loading branch information
smcv authored and alexlarsson committed Jan 25, 2022
1 parent dc8227e commit 6fdc907
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions triggers/desktop-database.trigger
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

if test \( -x "$(which update-desktop-database 2>/dev/null)" \) -a \( -d $1/exports/share/applications \); then
exec update-desktop-database -q $1/exports/share/applications
if test \( -x "$(which update-desktop-database 2>/dev/null)" \) -a \( -d "$1/exports/share/applications" \); then
exec update-desktop-database -q "$1/exports/share/applications"
fi
10 changes: 5 additions & 5 deletions triggers/gtk-icon-cache.trigger
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/sh

if test \( -x "$(which gtk-update-icon-cache 2>/dev/null)" \) -a \( -d $1/exports/share/icons/hicolor \); then
cp /usr/share/icons/hicolor/index.theme $1/exports/share/icons/hicolor/
for dir in $1/exports/share/icons/*; do
if test -f $dir/index.theme; then
if ! gtk-update-icon-cache --quiet $dir; then
if test \( -x "$(which gtk-update-icon-cache 2>/dev/null)" \) -a \( -d "$1/exports/share/icons/hicolor" \); then
cp /usr/share/icons/hicolor/index.theme "$1/exports/share/icons/hicolor/"
for dir in "$1"/exports/share/icons/*; do
if test -f "$dir/index.theme"; then
if ! gtk-update-icon-cache --quiet "$dir"; then
echo "Failed to run gtk-update-icon-cache for $dir"
exit 1
fi
Expand Down
4 changes: 2 additions & 2 deletions triggers/mime-database.trigger
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

if test \( -x "$(which update-mime-database 2>/dev/null)" \) -a \( -d $1/exports/share/mime/packages \); then
exec update-mime-database $1/exports/share/mime
if test \( -x "$(which update-mime-database 2>/dev/null)" \) -a \( -d "$1/exports/share/mime/packages" \); then
exec update-mime-database "$1/exports/share/mime"
fi

0 comments on commit 6fdc907

Please sign in to comment.