diff options
Diffstat (limited to 'sysui/desktop/share')
-rwxr-xr-x | sysui/desktop/share/add_specfile_triggers.sed | 4 | ||||
-rwxr-xr-x | sysui/desktop/share/apparmor.sh | 57 | ||||
-rw-r--r-- | sysui/desktop/share/brand.pl | 126 | ||||
-rwxr-xr-x | sysui/desktop/share/create_mime_xml.pl | 121 | ||||
-rwxr-xr-x | sysui/desktop/share/create_tree.sh | 64 | ||||
-rw-r--r-- | sysui/desktop/share/documents.ulf | 134 | ||||
-rw-r--r-- | sysui/desktop/share/launcher.ulf | 80 | ||||
-rwxr-xr-x | sysui/desktop/share/openoffice.sh | 2 |
8 files changed, 588 insertions, 0 deletions
diff --git a/sysui/desktop/share/add_specfile_triggers.sed b/sysui/desktop/share/add_specfile_triggers.sed new file mode 100755 index 0000000000..a8d9d2932a --- /dev/null +++ b/sysui/desktop/share/add_specfile_triggers.sed @@ -0,0 +1,4 @@ +/#include<symlink_triggers>/ { +r ../share/symlink_triggers +d +} diff --git a/sysui/desktop/share/apparmor.sh b/sysui/desktop/share/apparmor.sh new file mode 100755 index 0000000000..90d6ac34fd --- /dev/null +++ b/sysui/desktop/share/apparmor.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# This file is part of the LibreOffice project. +# ------------------------------------------------------------------ +# +# Copyright (C) 2016 Canonical Ltd. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Author: Bryan Quigley <bryan.quigley@canonical.com> +# +# ------------------------------------------------------------------ + +# This is a simple script to help get AppArmor working on different distros +# Generally these apparmor profiles target the latest LibreOffice + +INST_ROOT=$1 #Where libreoffice program folder can be found +PROFILESFROM=$2 #Where the profile files are +INSTALLTO=$3 #Where should the apparmor profiles (For manual use should be /etc/apparmor.d) +RESTART=$4 #Should we restart apparmor using service? +CHECK=$5 #Check parsing of the new profile? + +#Example uses: +#Ubuntu 16.04 with stock LibreOffice: +# sudo ./sysui/desktop/share/apparmor.sh /usr/lib/libreoffice/ sysui/desktop/apparmor/ /etc/apparmor.d/ true true + +#Ubuntu 16.04, with built debs from LibreOffice git +# sudo ./sysui/desktop/share/apparmor.sh /opt/libreofficedev5.2/ sysui/desktop/apparmor/ /etc/apparmor.d/ true true + +#Ubuntu 16.04, running from git! +# sudo ./sysui/desktop/share/apparmor.sh /mnt/store/git/libo/instdir/ sysui/desktop/apparmor/ /etc/apparmor.d/ true true + +#Need to convert / to . for profile names +INST_ROOT_FORMAT=${INST_ROOT/\//} +INST_ROOT_FORMAT=${INST_ROOT_FORMAT////.} + +#Need to escape / for sed +INST_ROOT_SED=${INST_ROOT////\\/} + +for filename in $PROFILESFROM/* +do + [[ -e $filename ]] || { echo "No profile files found in ""$PROFILESFROM"; exit 1; } + tourl=$INSTALLTO$INST_ROOT_FORMAT${filename##*/} + sed "s/INSTDIR-/$INST_ROOT_SED/g" "$filename" > "$tourl" + echo "$tourl" + if [ "$CHECK" = "true" ]; then + # check profile parsing + echo "Checking $tourl profile." + /sbin/apparmor_parser --add --skip-cache --skip-kernel-load $tourl + fi +done + +if [ "$RESTART" = true ] ; then + echo "Restarting AppArmor" + service apparmor restart +fi diff --git a/sysui/desktop/share/brand.pl b/sysui/desktop/share/brand.pl new file mode 100644 index 0000000000..e02c4ef6d0 --- /dev/null +++ b/sysui/desktop/share/brand.pl @@ -0,0 +1,126 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; + +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +# +# This tool is used to re-write and substitute variables +# into Unix .desktop, .keys files etc. +# + +$destdir = pop @ARGV; +mkdir $destdir,0777; + +$productname = "LibreOffice"; +$productfilename = "libreoffice"; +$urls = 0; +$prefix = ""; +$iconprefix = ""; + +while ($_ = $ARGV[0], /^-/) { + shift; + last if /^--$/; + if (/^-p/) { + $productname = $ARGV[0]; + shift; + } + if (/^-u/) { + $productfilename = $ARGV[0]; + shift; + } + if (/^--prefix/) { + $prefix = $ARGV[0]; + shift; + } + if (/^--iconprefix/) { + $iconprefix = $ARGV[0]; + shift; + } + if (/^--category/) { + $category = $ARGV[0]; + shift; + } + # Whether we can handle URLs on the command-line + if (/^--urls/) { + $urls = 1; + } +} + + +while ($arg = shift) { + unless (open INFILE,$arg) { + print STDOUT "Can't open input file $arg: $!\n"; + exit 1; + } + + $srcfile = substr($arg, rindex($arg, "/") + 1); + + unless (open OUTFILE,"> $destdir/$prefix$srcfile") { + print STDOUT "Can't open output file $destdir/$prefix$srcfile: $!\n"; + exit 1; + } + + while (<INFILE>) { + # remove possible Windows line-ends + chomp; + + # patch all icons in ICON line with $prefix + if (! /Icon=document-new/ ) { # except for Icon=document-new which + # is a stock icon, not one of ours + s/Icon=/Icon=$iconprefix/; + } + + # patch all occurrences of openoffice in EXEC line with + # $productfilename + if ( /Exec/ ) { + s/openoffice/$productfilename/; + } + + # if $productfilename != "openoffice, add it to the list + # of applications. + if ( /user_level=$/ ) { + $_ = $_ . $productfilename; + } elsif ( /user_level/ ) { + s/$productfilename,//; + s/user_level=/user_level=$productfilename,/ + } + + # append special category if specified + if ( /Categories/ ) { + if ( length($category) > 0 ) { + $_ = "$_$category;"; + } + } + + # replace %PRODUCTNAME placeholders + s/%PRODUCTNAME/$productname/g; + + if ( $urls ) { + s/%%FILE%%/%U/g; + } else { + s/%%FILE%%/%F/g; + } + + print OUTFILE "$_\n"; + } + + close(OUTFILE); + close(INFILE); +} diff --git a/sysui/desktop/share/create_mime_xml.pl b/sysui/desktop/share/create_mime_xml.pl new file mode 100755 index 0000000000..4d41cf43ea --- /dev/null +++ b/sysui/desktop/share/create_mime_xml.pl @@ -0,0 +1,121 @@ +#!/usr/bin/env perl +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +use File::Basename; +$basedir = dirname($0); +$productname = 'LibreOffice'; +$mimedir = $basedir.'/../mimetypes'; + +$FS= ' '; # field separator (space) - for documents.ulf +$, = "\n"; # set output field separator (newline) +$\ = "\n"; # set output record separator (newline) + +## get list of components and corresponding translations from documents.ulf +open(DOCUMENTS_ULF, $ARGV[0]) || die 'Cannot open "documents.ulf".'; +while (<DOCUMENTS_ULF>) { + if (/^\[/) { + # section starts + s/^\[(.*)]/$1/; + chomp; + $module = $_; + } else { + # translated strings + ($lang,$junk,$comment) = split($FS, $_, 3); + $comment =~ s/^"(.*)"$/$1/; + $comment =~ s/%PRODUCTNAME/$productname/; + chomp $lang; + chomp $comment; + if ($lang eq "en-US") { + $value = " <comment>$comment</comment>"; + } else { + $value = ' <comment xml:lang="'.$lang.'">'.$comment.'</comment>'; + } + push(@{$mimehash{$module}}, $value) unless $lang eq ""; + } +} +close DOCUMENTS_ULF; + +## creating the xml on stdout +print '<?xml version="1.0" encoding="UTF-8"?>'; +print '<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">'; + +foreach $component (sort(keys %mimehash)) { + # mimetype and glob + getMimedata($component); + print ' <mime-type type="'.$mimetype.'">'; + print (sort({customsort($a) cmp customsort($b)} @{$mimehash{$component}})); + print ' <glob pattern="'.$glob.'"/>'; + if ( $component =~ /oasis/ ) { + if ( $component =~ /flat-xml/ ) { + print ' <sub-class-of type="application/xml"/>'; + print ' <magic'.( $mimetype =~ /-/ ? ' priority="60"' : '').'>'; + print ' <match value="<?xml" type="string" offset="0">'; + print ' <match value="office:document" type="string" offset="4:100">'; + print ' <match value="office:mimetype="' . $mimetype . '"" type="string" offset="100:4000"/>'; + print ' </match>'; + print ' </match>'; + print ' </magic>'; + } else { + print ' <magic'.( $mimetype =~ /-/ ? ' priority="60"' : '').'>'; + print ' <match value="PK\003\004" type="string" offset="0">'; + print ' <match value="mimetype" type="string" offset="30">'; + print ' <match value="' . $mimetype . '" type="string" offset="38"/>'; + print ' </match>'; + print ' </match>'; + print ' </magic>'; + } + } + print ' </mime-type>'; +} +print '</mime-info>'; + +sub customsort { + # sort <comment> before <comment xml:lang...> + $in = shift; + $in =~ tr/>/A/; + $in =~ tr/ /Z/; + return $in; +} + +## get mime-type and glob from ../mimetype/*.desktop +sub getMimedata { + $desktop_name = shift; + $desktop_file = $mimedir.'/'.$desktop_name.'.desktop'; + $mimetype = ""; + $glob = ""; + open(DESKTOP_FILE, $desktop_file) || die "Cannot open desktop-file $desktop_file. ".$!; + while (<DESKTOP_FILE>) { + ## get mimetype + if (/^MimeType=/) { + s/^MimeType=(.*)\n$/$1/; + $mimetype = "$_"; + } + ## get glob + if (/^Patterns=/) { + s/^Patterns=(.*)\n$/\1/; + $glob = "$_"; + } + } + close DESKTOP_FILE; + # die if we cannot determine the glob-pattern or mimtetype + die "Could not get mime-type from $desktop_file" if ($mimetype eq ""); + die "Could not get glob-pattern from $desktop_file" if ($glob eq ""); +} + +## END vim: set ts=4: diff --git a/sysui/desktop/share/create_tree.sh b/sysui/desktop/share/create_tree.sh new file mode 100755 index 0000000000..ce6475cd5c --- /dev/null +++ b/sysui/desktop/share/create_tree.sh @@ -0,0 +1,64 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +umask 022 + +if [ "${KDEMAINDIR}" ]; then + for i in `cd "${ICON_SOURCE_DIR}"; find ${ICON_THEMES:-hicolor/???x??? hicolor/??x??} -name "*.png"; find hicolor/scalable/apps -name "*.svg"` + do + targetdir=${DESTDIR}/${KDEMAINDIR}/share/icons/`dirname ${i}` + mkdir -p "${targetdir}" + destfile=$targetdir/${ICON_PREFIX:-}${ICON_PREFIX:+-}`basename ${i}` + cp "${ICON_SOURCE_DIR}/${i}" "${destfile}" + chmod 0644 "${destfile}" + done + unset targetdir destfile + +fi + +mkdir -p "${DESTDIR}/${BINDIR}" + +test -n "${OFFICE_PREFIX}" && office_prefix="${OFFICE_PREFIX}" || office_prefix=/opt +office_root=${office_prefix}/${PREFIX} + +#this symlink is needed to have the API bootstrap functions running right +ln -sf "${office_root}/program/soffice" "${DESTDIR}/${BINDIR}/${PREFIX}" + +if test "${PREFIX}" != libreoffice${PRODUCTVERSION} -a "${PREFIX}" != libreofficedev${PRODUCTVERSION} ; then + # compat symlinks + mkdir -p "${DESTDIR}${office_prefix}" + ln -sf libreoffice${PRODUCTVERSION} "${DESTDIR}${office_root}" + ln -sf /${BINDIR}/${PREFIX} "${DESTDIR}/${BINDIR}/libreoffice${PRODUCTVERSION}" +fi + +test "${PREFIX}" = libreofficedev${PRODUCTVERSION} && mime_def_file="libreofficedev${PRODUCTVERSION}.xml" || mime_def_file="libreoffice${PRODUCTVERSION}.xml" +mkdir -p "${DESTDIR}/${PREFIXDIR}/share/mime/packages" +cp openoffice.org.xml "${DESTDIR}/${PREFIXDIR}/share/mime/packages/$mime_def_file" +chmod 0644 "${DESTDIR}/${PREFIXDIR}/share/mime/packages/$mime_def_file" + +mkdir -p "${DESTDIR}/${PREFIXDIR}/share/applications" +for i in `cat launcherlist`; do + ln -sf "${office_root}/share/xdg/${i}" "${DESTDIR}/${PREFIXDIR}/share/applications/${PREFIX}-${i}" +done + +mkdir -p "${DESTDIR}/${PREFIXDIR}/share/metainfo" +for i in base calc draw impress writer; do + cp "${APPDATA_SOURCE_DIR}/libreoffice-${i}.appdata.xml" "${DESTDIR}/${PREFIXDIR}/share/metainfo/${PREFIX}-${i}.appdata.xml" +done +cp "${APPDATA_SOURCE_DIR}/org.libreoffice.kde.metainfo.xml" "${DESTDIR}/${PREFIXDIR}/share/metainfo/org.${PREFIX}.kde.metainfo.xml" + diff --git a/sysui/desktop/share/documents.ulf b/sysui/desktop/share/documents.ulf new file mode 100644 index 0000000000..2073c17c36 --- /dev/null +++ b/sysui/desktop/share/documents.ulf @@ -0,0 +1,134 @@ +[text] +en-US = "OpenOffice.org 1.0 Text Document" + +[text-template] +en-US = "OpenOffice.org 1.0 Text Document Template" + +[master-document] +en-US = "OpenOffice.org 1.0 Master Document" + +[formula] +en-US = "OpenOffice.org 1.0 Formula" + +[presentation] +en-US = "OpenOffice.org 1.0 Presentation" + +[presentation-template] +en-US = "OpenOffice.org 1.0 Presentation Template" + +[drawing] +en-US = "OpenOffice.org 1.0 Drawing" + +[drawing-template] +en-US = "OpenOffice.org 1.0 Drawing Template" + +[spreadsheet] +en-US = "OpenOffice.org 1.0 Spreadsheet" + +[spreadsheet-template] +en-US = "OpenOffice.org 1.0 Spreadsheet Template" + +[oasis-text] +en-US = "OpenDocument Text" + +[oasis-text-flat-xml] +en-US = "OpenDocument Text (Flat XML)" + +[oasis-text-template] +en-US = "OpenDocument Text Template" + +[oasis-master-document] +en-US = "OpenDocument Master Document" + +[oasis-master-document-template] +en-US = "OpenDocument Master Document Template" + +[oasis-formula] +en-US = "OpenDocument Formula" + +[oasis-presentation] +en-US = "OpenDocument Presentation" + +[oasis-presentation-flat-xml] +en-US = "OpenDocument Presentation (Flat XML)" + +[oasis-presentation-template] +en-US = "OpenDocument Presentation Template" + +[oasis-drawing] +en-US = "OpenDocument Drawing" + +[oasis-drawing-flat-xml] +en-US = "OpenDocument Drawing (Flat XML)" + +[oasis-drawing-template] +en-US = "OpenDocument Drawing Template" + +[oasis-spreadsheet] +en-US = "OpenDocument Spreadsheet" + +[oasis-spreadsheet-flat-xml] +en-US = "OpenDocument Spreadsheet (Flat XML)" + +[oasis-spreadsheet-template] +en-US = "OpenDocument Spreadsheet Template" + +[oasis-database] +en-US = "OpenDocument Database" + +[oasis-web-template] +en-US = "HTML Document Template" + +[extension] +en-US = "%PRODUCTNAME Extension" + +[ms-excel-sheet] +en-US = "Microsoft Excel Worksheet" + +[ms-powerpoint-presentation] +en-US = "Microsoft PowerPoint Presentation" + +[ms-word-document] +en-US = "Microsoft Word Document" + +[ms-word-document2] +en-US = "Microsoft Word Document" + +[ms-excel-sheet-12] +en-US = "Microsoft Excel Worksheet" + +[ms-excel-template-12] +en-US = "Microsoft Excel Worksheet Template" + +[ms-powerpoint-presentation-12] +en-US = "Microsoft PowerPoint Presentation" + +[ms-powerpoint-template-12] +en-US = "Microsoft PowerPoint Presentation Template" + +[ms-word-document-12] +en-US = "Microsoft Word Document" + +[ms-word-template-12] +en-US = "Microsoft Word Document Template" + +[openxmlformats-officedocument-presentationml-presentation] +en-US = "Microsoft PowerPoint Presentation" + +[openxmlformats-officedocument-presentationml-template] +en-US = "Microsoft PowerPoint Presentation Template" + +[openxmlformats-officedocument-spreadsheetml-sheet] +en-US = "Microsoft Excel Worksheet" + +[openxmlformats-officedocument-spreadsheetml-template] +en-US = "Microsoft Excel Worksheet Template" + +[openxmlformats-officedocument-wordprocessingml-document] +en-US = "Microsoft Word Document" + +[openxmlformats-officedocument-wordprocessingml-template] +en-US = "Microsoft Word Document Template" + +[ms-excel-sheet-binary-12] +en-US = "Microsoft Excel Worksheet" diff --git a/sysui/desktop/share/launcher.ulf b/sysui/desktop/share/launcher.ulf new file mode 100644 index 0000000000..78c260cce6 --- /dev/null +++ b/sysui/desktop/share/launcher.ulf @@ -0,0 +1,80 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +[writer_Comment] +en-US = "Create and edit text and graphics in letters, reports, documents and Web pages." + +[impress_Comment] +en-US = "Create and edit presentations for slideshows, meetings and Web pages." + +[draw_Comment] +en-US = "Create and edit drawings, flow charts and logos." + +[calc_Comment] +en-US = "Perform calculations, analyze information and manage lists in spreadsheets." + +[math_Comment] +en-US = "Create and edit scientific formulas and equations." + +[base_Comment] +en-US = "Manage databases, create queries and reports to track and manage your information." + +[startcenter_Comment] +en-US = "Launch applications to create text documents, spreadsheets, presentations, drawings, formulas, and databases, or open recently used documents." + +[writer_GenericName] +en-US = "Word Processor" + +[impress_GenericName] +en-US = "Presentation" + +[calc_GenericName] +en-US = "Spreadsheet" + +[base_GenericName] +en-US = "Database Development" + +[math_GenericName] +en-US = "Formula Editor" + +[draw_GenericName] +en-US = "Drawing Program" + +[startcenter_GenericName] +en-US = "Office" + +[xsltfilter_GenericName] +en-US = "XSLT based filters" + +[writer_UnityQuickList] +en-US = "New Document" + +[impress_UnityQuickList] +en-US = "New Presentation" + +[calc_UnityQuickList] +en-US = "New Spreadsheet" + +[base_UnityQuickList] +en-US = "New Database" + +[math_UnityQuickList] +en-US = "New Formula" + +[draw_UnityQuickList] +en-US = "New Drawing" diff --git a/sysui/desktop/share/openoffice.sh b/sysui/desktop/share/openoffice.sh new file mode 100755 index 0000000000..d3ecf978ee --- /dev/null +++ b/sysui/desktop/share/openoffice.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec /opt/%PREFIX/program/soffice "$@" |