| 1 | #! /bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # |
| 3 | # This file is part of the LibreOffice project. |
| 4 | # |
| 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/. |
| 8 | # |
| 9 | |
| 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. |
| 12 | # |
| 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 | # $3.*.desktop files |
| 18 | # $3 the flatpak ID |
| 19 | |
| 20 | set -e |
| 21 | |
| 22 | ## libreoffice-*.desktop -> $3.*.desktop: |
| 23 | for i in "${1?}"libreoffice-*.desktop |
| 24 | do |
| 25 | sedscip-shell system . . sed. -e "s/^Icon=libreoffice-/Icon=${3?}./" "$i" \ |
| 26 | >"${2?}${3?}"."${i#"${1?}"libreoffice-}" |
| 27 | done |
| 28 | mvscip-shell system . . mv. "${2?}${3?}".startcenter.desktop "${2?}${3?}".desktop |
| 29 | |
| 30 | # Flatpak .desktop exports take precedence over system ones due to |
| 31 | # the order of XDG_DATA_DIRS - re-associating text/plain seems a bit much |
| 32 | sedscip-shell system . . sed. -i "s/text\/plain;//" "${2?}${3?}".writer.desktop |
| 33 | |
| 34 | desktop-file-edit --set-key=X-Endless-Alias --set-value=libreoffice-startcenter \ |
| 35 | --set-key=X-Flatpak-RenamedFrom --set-value='libreoffice-startcenter.desktop;' \ |
| 36 | "${2?}${3?}".desktop |
| 37 | for i in base calc draw impress math writer xsltfilter |
| 38 | do |
| 39 | desktop-file-edit --set-key=X-Endless-Alias --set-value=libreoffice-"$i" \ |
| 40 | --set-key=X-Flatpak-RenamedFrom \ |
| 41 | --set-value="libreoffice-$i.desktop;${3?}-$i.desktop;" \ |
| 42 | "${2?}${3?}"."$i".desktop |
| 43 | done |