PRODUCTNAME -> %PRODUCTNAME
[LibreOffice.git] / solenv / bin / assemble-flatpak-desktop.sh
blob6d06de4fbbbef999b681573f2c77a276aef2e70a
1 #! /bin/bash
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # Part of solenv/bin/assemble-flatpak.sh that is shared with a downstream mechanism of building a
11 # Flatpak from a Fedora libreoffice.spec file.
13 # Arguments:
14 # $1 pathname, ending in a slash, of the directory containing the source libreoffice-*.desktop
15 # files
16 # $2 pathname, ending in a slash, of the directory into which to put the target
17 # org.libreoffice.LibreOffice.*.desktop files
19 set -e
21 ## libreoffice-*.desktop -> org.libreoffice.LibreOffice.*.desktop:
22 for i in "${1?}"libreoffice-*.desktop
24 sed -e 's/^Icon=libreoffice-/Icon=org.libreoffice.LibreOffice./' "$i" \
25 >"${2?}"org.libreoffice.LibreOffice."${i#"${1?}"libreoffice-}"
26 done
27 mv "${2?}"org.libreoffice.LibreOffice.startcenter.desktop "${2?}"org.libreoffice.LibreOffice.desktop
29 # Flatpak .desktop exports take precedence over system ones due to
30 # the order of XDG_DATA_DIRS - re-associating text/plain seems a bit much
31 sed -i "s/text\/plain;//" "${2?}"org.libreoffice.LibreOffice.writer.desktop
33 desktop-file-edit --set-key=X-Endless-Alias --set-value=libreoffice-startcenter \
34 --set-key=X-Flatpak-RenamedFrom --set-value='libreoffice-startcenter.desktop;' \
35 "${2?}"org.libreoffice.LibreOffice.desktop
36 for i in base calc draw impress math writer xsltfilter
38 desktop-file-edit --set-key=X-Endless-Alias --set-value=libreoffice-"$i" \
39 --set-key=X-Flatpak-RenamedFrom \
40 --set-value="libreoffice-$i.desktop;org.libreoffice.LibreOffice-$i.desktop;" \
41 "${2?}"org.libreoffice.LibreOffice."$i".desktop
42 done