Hello community,

here is the log from the commit of package libreoffice-share-linker.4657 for 
openSUSE:13.2:Update checked in at 2016-02-25 21:45:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.2:Update/libreoffice-share-linker.4657 (Old)
 and      /work/SRC/openSUSE:13.2:Update/.libreoffice-share-linker.4657.new 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libreoffice-share-linker.4657"

Changes:
--------
New Changes file:

--- /dev/null   2016-01-27 19:41:03.648095915 +0100
+++ 
/work/SRC/openSUSE:13.2:Update/.libreoffice-share-linker.4657.new/libreoffice-share-linker.changes
  2016-02-25 21:45:16.000000000 +0100
@@ -0,0 +1,6 @@
+-------------------------------------------------------------------
+Wed May 20 08:35:28 UTC 2015 - [email protected]
+
+- Initial commit, split out from main libreoffice package to workaround
+  issues on SLE11 build
+

New:
----
  libreoffice-share-linker.changes
  libreoffice-share-linker.spec
  link-to-ooo-home

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libreoffice-share-linker.spec ++++++
#
# spec file for package libreoffice-share-linker
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           libreoffice-share-linker
Version:        1
Release:        0
Summary:        Script to link/unlink files to libreoffice home
License:        MIT
Group:          Productivity/Office/Suite
Url:            http://www.opensuse.org/
Source0:        link-to-ooo-home
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
Script that links and unlinks files from %{_datadir} to libreoffice
home as libreoffice layout is not set up for noarch packages otherwise.

%prep
:

%build
:

%install
install -Dm 755 %{SOURCE0} %{buildroot}%{_bindir}/%{name}

%files
%defattr(-,root,root)
%{_bindir}/%{name}

%changelog
++++++ link-to-ooo-home ++++++
#!/usr/bin/env bash

usage() {
    echo "This script (un)links or unlinks the given to/from libreoffice home"
    echo
    echo "Usage: ${0##*/} [--unlink] filelist"
}

change_linking() {
    local libdir="$1"
    local filelist="$2"
    local linkfile=""
    local linkdir=""

    # Decide if we are linking or wiping first
    if ${link_mode}; then
        # Grab all files from the proper folder
        for file in `cat ${filelist} | grep "/usr/share/libreoffice" | sort`; do
            # if we get ourselves folder then just create it
            # it might not be around so lets be safe
            if [[ -d "${file}" ]] ; then
                dirname="${file/${datadir}/${libdir}}"
                # if the location is already there skip it
                if [[ ! -e "${dirname}" ]]; then
                    mkdir -p "${dirname}"
                fi
                continue
            fi
            linkfile="${file/${datadir}/${libdir}}"
            # if the file is already there, skip it
            # this is true when the parent folder is link
            if [[ ! -e "${linkfile}" ]]; then
                ln -sf "${file}" "${linkfile}" || exit 1
            fi
        done
    else
        # first just remove the symlinks
        for file in `cat ${filelist} | grep "/usr/share/libreoffice" | sort`; do
            linkfile=${file/${datadir}/${libdir}}
            if [[ -L "${linkfile}" && ! -r "${linkfile}" && ! -d "${linkfile}" 
]]; then
                rm -f "${linkfile}" || exit 1
            fi
        done
        # continue by wiping out all EMPTY dirs
        # we have to be sure it is not owned by anything else
        # doing in 2nd run to ensure avoiding collisions
        for file in `cat ${filelist} | grep "/usr/share/libreoffice" | sort`; do
            linkdir="${file/${datadir}/${libdir}}"
            if [[ -d "${linkdir}" && -z `ls "${linkdir}"/*` ]]; then
                # check if nothing else owns the dir
                if [[ $(rpm -qf "${file}" 2>/dev/null |wc -l) == 0 ]]; then
                    rmdir "${linkdir}" || exit 1
                fi
            fi
        done
    fi
}

# Global VARS
link_mode=true
datadir=/usr/share
libdirs=(
    "/usr/lib/"
    "/usr/lib64/"
    "/usr/lib32/"
)

if [[ "$1" == "--unlink" ]]; then
    link_mode=false
    shift
fi

if [[ "$1" == "--help" ]]; then
    usage
    exit 0
fi

# Verify we have just one left argument which is the filelist
if [[ $# > 1 || ! -f "$1" ]]; then
    usage
    exit 1
fi

for libdir in ${libdirs[@]}; do
    # for each dir verify there is libreoffice folder, otherwise skip
    if [[ ! -d "${libdir}/libreoffice/" ]]; then
        continue
    fi
    change_linking ${libdir} $1
    # remove dangling links as they might happen when migratin from older
    # libreoffice versions
    find ${libdir}/libreoffice -type l -xtype l -delete
done

Reply via email to