Avoid potential negative array index access to cached text.
[LibreOffice.git] / sysui / desktop / share / create_tree.sh
blob159a6409311372a3b6e7031dacdcd13440eb3b92
2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 umask 022
21 if [ "${KDEMAINDIR}" ]; then
22 for i in `cd "${ICON_SOURCE_DIR}"; find ${ICON_THEMES:-hicolor/???x??? hicolor/??x??} -name "*.png"; find hicolor/scalable/apps -name "*.svg"`
24 targetdir=${DESTDIR}/${KDEMAINDIR}/share/icons/`dirname ${i}`
25 mkdir -p "${targetdir}"
26 destfile=$targetdir/${ICON_PREFIX:-}${ICON_PREFIX:+-}`basename ${i}`
27 cp "${ICON_SOURCE_DIR}/${i}" "${destfile}"
28 chmod 0644 "${destfile}"
29 done
30 unset targetdir destfile
34 mkdir -p "${DESTDIR}/${BINDIR}"
36 test -n "${OFFICE_PREFIX}" && office_prefix="${OFFICE_PREFIX}" || office_prefix=/opt
37 office_root=${office_prefix}/${PREFIX}
39 #this symlink is needed to have the API bootstrap functions running right
40 ln -sf "${office_root}/program/soffice" "${DESTDIR}/${BINDIR}/${PREFIX}"
42 if test "${PREFIX}" != collaboraoffice -a "${PREFIX}" != collaboraofficedev ; then
43 # compat symlinks
44 mkdir -p "${DESTDIR}${office_prefix}"
45 ln -sf collaboraoffice "${DESTDIR}${office_root}"
46 ln -sf /${BINDIR}/${PREFIX} "${DESTDIR}/${PREFIXDIR}/bin/collaboraoffice"
49 test "${PREFIX}" = collaboraofficedev && mime_def_file="collaboraofficedev.xml" || mime_def_file="collaboraoffice.xml"
50 mkdir -p "${DESTDIR}/${PREFIXDIR}/share/mime/packages"
51 cp openoffice.org.xml "${DESTDIR}/${PREFIXDIR}/share/mime/packages/$mime_def_file"
52 chmod 0644 "${DESTDIR}/${PREFIXDIR}/share/mime/packages/$mime_def_file"
54 mkdir -p "${DESTDIR}/${PREFIXDIR}/share/applications"
55 for i in `cat launcherlist`; do
56 ln -sf "${office_root}/share/xdg/${i}" "${DESTDIR}/${PREFIXDIR}/share/applications/${PREFIX}-${i}"
57 done
59 mkdir -p "${DESTDIR}/${PREFIXDIR}/share/metainfo"
60 for i in base calc draw impress writer; do
61 cp "${APPDATA_SOURCE_DIR}/libreoffice-${i}.appdata.xml" "${DESTDIR}/${PREFIXDIR}/share/metainfo/${PREFIX}-${i}.appdata.xml"
62 done
63 cp "${APPDATA_SOURCE_DIR}/org.libreoffice.kde.metainfo.xml" "${DESTDIR}/${PREFIXDIR}/share/metainfo/org.${PREFIX}.kde.metainfo.xml"