core-agent-linux/qubes-rpc/qubes.GetAppmenus
Marek Marczykowski-Górecki 9c839d789f
qubes-rpc: fix issues found by shellcheck
Most of them are missing quotes, `` -> $(), and -o/-a usage in
conditions. Also add few directives disabling checks where were too
verbose.
2017-09-30 04:45:31 +02:00

12 lines
522 B
Bash
Executable File

#!/bin/sh
# shellcheck disable=SC2016
find /usr/share/applications/ /usr/local/share/applications/ -name '*.desktop' -print0 2>/dev/null | \
xargs -0 awk '
BEGINFILE { entry="" }
/^\[/ { if (tolower($0) != "\[desktop entry\]") nextfile }
/^Exec=/ { entry = entry FILENAME ":Exec=qubes-desktop-run " FILENAME "\n"; next }
/^NoDisplay *= *true$/ { entry=""; nextfile }
/=/ { entry = entry FILENAME ":" $0 "\n" }
ENDFILE { print entry }
' 2> /dev/null