Commit 7e0a307e authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm repack common.sh: add get_desktop_value()

parent 0e9b2f17
...@@ -579,6 +579,13 @@ use_system_xdg() ...@@ -579,6 +579,13 @@ use_system_xdg()
done done
} }
get_desktop_value()
{
local DESKTOPFILE="$1"
local FIELD="$2"
cat "$DESKTOPFILE" | grep "^$FIELD=" | head -n1 | sed -e 's|^'"$FIELD"'=||' -e 's| .*||'
}
[ -d "$BUILDROOT" ] || fatal "Run me only via epm repack <package>" [ -d "$BUILDROOT" ] || fatal "Run me only via epm repack <package>"
......
...@@ -32,7 +32,8 @@ if [ -f "$BUILDROOT$PRODUCTDIR/$PRODUCT" ] ; then ...@@ -32,7 +32,8 @@ if [ -f "$BUILDROOT$PRODUCTDIR/$PRODUCT" ] ; then
fi fi
if [ -f $BUILDROOT/usr/share/applications/*.desktop ] ; then if [ -f $BUILDROOT/usr/share/applications/*.desktop ] ; then
EXEC="$(cat $BUILDROOT/usr/share/applications/*.desktop | grep "^Exec=" | head -n1 | sed -e 's|Exec=||' -e 's| .*||')" EXEC="$(get_desktop_value "$BUILDROOT/usr/share/applications/*.desktop" "Exec")"
# replace /opt path with command name only
if [ "/usr/bin/$(basename "$EXEC")" = "/usr/bin/$PRODUCT" ] || [ "$EXEC" = "$PRODUCTDIR/$PRODUCT" ] ; then if [ "/usr/bin/$(basename "$EXEC")" = "/usr/bin/$PRODUCT" ] || [ "$EXEC" = "$PRODUCTDIR/$PRODUCT" ] ; then
if [ -x $BUILDROOT/usr/bin/$PRODUCT ] ; then if [ -x $BUILDROOT/usr/bin/$PRODUCT ] ; then
fix_desktop_file "$EXEC" fix_desktop_file "$EXEC"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment