forked from pool/libreoffice
More WIP.
OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=67
This commit is contained in:
parent
dea8f61c24
commit
034045383f
@ -7,7 +7,7 @@
|
||||
<size unit="M">6000</size>
|
||||
</memory>
|
||||
<disk>
|
||||
<size unit="G">15</size>
|
||||
<size unit="G">18</size>
|
||||
</disk>
|
||||
</hardware>
|
||||
</constraints>
|
||||
|
@ -1,3 +1,24 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 3 20:43:30 UTC 2014 - tchvatal@suse.com
|
||||
|
||||
- Drop base-extensions, empty package too.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 3 19:54:53 UTC 2014 - tchvatal@suse.com
|
||||
|
||||
- Readjust the link-ooo-home script to delete empty folders if not
|
||||
owned and add few comments there.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 3 18:37:07 UTC 2014 - tchvatal@suse.com
|
||||
|
||||
- Remove lo_prefix and lo_home vars as they are pointless nowdays
|
||||
- Remove the debug switch to control ccache, it is controled
|
||||
already in obs so it is pointless in spec
|
||||
- Increase Disk requirement for 18 gb, it was 17 here on local
|
||||
build so it should be safe again to build.
|
||||
- Mark more files for /usr/share move
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 2 23:41:44 UTC 2014 - tchvatal@suse.com
|
||||
|
||||
|
166
libreoffice.spec
166
libreoffice.spec
@ -18,12 +18,6 @@
|
||||
|
||||
# List of supported langs, populated bellow in the lang macros
|
||||
%global langpack_langs %{nil}
|
||||
# debug_build: 0 = no ( do not use ccache
|
||||
# 1 = yes
|
||||
%define debug_build 0
|
||||
# LO paths
|
||||
%define lo_prefix %{_libdir}
|
||||
%define lo_home libreoffice
|
||||
# extensions
|
||||
%define ct2n_version 1.3.2
|
||||
%define gdocs_version 3.0.1
|
||||
@ -100,7 +94,7 @@ Patch5: scp2-user-config-suse.diff
|
||||
# pack new desktop files
|
||||
Patch6: pack-desktop-files-for-optional-filters.diff
|
||||
# As the patch2 and usr share search is broken we can't do this anymore
|
||||
# search <lo-home>/share/template/common for language independent templates
|
||||
# search libreoffice/share/template/common for language independent templates
|
||||
# FIXME: make it configurable to push upstream
|
||||
Patch9: office-cfg-linux-common-template-dir.diff
|
||||
# correctly bootstrap python stuff with system python (deb#501028, i#90701)
|
||||
@ -232,6 +226,9 @@ Obsoletes: %{name}-draw-extensions < %{version}
|
||||
Provides: %{name}-impress-extensions = %{version}
|
||||
Obsoletes: %{name}-impress-extensions < %{version}
|
||||
# Remove after 13.1 is out of support scope
|
||||
Provides: %{name}-base-extensions = %{version}
|
||||
Obsoletes: %{name}-base-extensions < %{version}
|
||||
# Remove after 13.1 is out of support scope
|
||||
Provides: %{name}-kde = %{version}
|
||||
Obsoletes: %{name}-kde < %{version}
|
||||
# Remove after 13.1 is out of support scope
|
||||
@ -534,17 +531,6 @@ developers to access the complete LibreOffice API from their Java
|
||||
environment giving them full control over the embedded document, its
|
||||
appearance and behavior.
|
||||
|
||||
%package base-extensions
|
||||
Summary: LibreOffice Base Extensions
|
||||
License: GPL-2.0 and LGPL-2.1 and LGPL-3.0 and W3C
|
||||
Group: Productivity/Office/Suite
|
||||
Requires: libreoffice-base = %{version}
|
||||
Requires(pre): libreoffice = %{version}
|
||||
|
||||
%description base-extensions
|
||||
This package provides extensions for LibreOffice Base:
|
||||
- Report Builder
|
||||
|
||||
%package base-drivers-mysql
|
||||
Summary: MySQL Database Driver for LibreOffice
|
||||
License: GPL-2.0 and LGPL-3.0
|
||||
@ -905,21 +891,19 @@ export NOCONFIGURE=yes
|
||||
--enable-ext-mariadb-connector \
|
||||
--enable-scripting-beanshell \
|
||||
--enable-scripting-javascript \
|
||||
--enable-telepathy \
|
||||
--enable-opengl \
|
||||
--enable-vlc \
|
||||
--enable-neon \
|
||||
--enable-telepathy \
|
||||
--enable-opengl \
|
||||
--enable-vlc \
|
||||
--enable-neon \
|
||||
--with-system-ucpp \
|
||||
%if %{debug_build} == 0
|
||||
--disable-ccache \
|
||||
%endif
|
||||
%ifarch ppc64
|
||||
--disable-report-builder \
|
||||
%endif
|
||||
--without-system-jfreereport
|
||||
|
||||
# hack to correctly bootstrap python stuff with system python, (deb#501028, i#90701)
|
||||
sed -i -e "s|@INSTALLDIR@|%{lo_prefix}/%{lo_home}|" pyuno/source/module/uno.py scripting/source/pyprov/officehelper.py
|
||||
sed -i -e "s|@INSTALLDIR@|%{_libdir}/%{name}|" pyuno/source/module/uno.py scripting/source/pyprov/officehelper.py
|
||||
|
||||
# just call make here as we added the jobs in configure
|
||||
make build-nocheck
|
||||
@ -938,9 +922,9 @@ builddir=`pwd`
|
||||
cd %{buildroot}%{_datadir}/applications
|
||||
for desktop in * ; do
|
||||
# relative link is needed by %%suse_update_desktop_file
|
||||
relative_target=`readlink $desktop | sed "s|%lo_prefix|../../%_lib|"`
|
||||
relative_target=`readlink $desktop | sed "s|%{_libdir}|../../%_lib|"`
|
||||
# FIXME: remove the libreoffice- prefix because the old desktop files are preferred in /etc/gnome_defaults.conf
|
||||
desktop_new=`echo $desktop | sed -e "s/%lo_home-//"`
|
||||
desktop_new=`echo $desktop | sed -e "s/%name-//"`
|
||||
rm $desktop
|
||||
sed -i -e "s|%_datadir/applications/$desktop|%_datadir/applications/$desktop_new|" $builddir/file-lists/*.txt
|
||||
# finally, create the right link
|
||||
@ -956,11 +940,11 @@ sed -i -e 's:Office;:Office;Spreadsheet;:g' %{buildroot}/%_datadir/applications/
|
||||
cd -
|
||||
################
|
||||
# compat stuff for noarch packages
|
||||
mkdir -p %{buildroot}/%{_datadir}/%{lo_home}/program
|
||||
install -m 755 $RPM_SOURCE_DIR/link-to-ooo-home %{buildroot}%{_datadir}/%{lo_home}/
|
||||
echo "%dir %{_datadir}/%{lo_home}" >>file-lists/common_list.txt
|
||||
echo "%dir %{_datadir}/%{lo_home}/program" >>file-lists/common_list.txt
|
||||
echo "%{_datadir}/%{lo_home}/link-to-ooo-home" >>file-lists/common_list.txt
|
||||
mkdir -p %{buildroot}/%{_datadir}/%{name}/program
|
||||
install -m 755 $RPM_SOURCE_DIR/link-to-ooo-home %{buildroot}%{_datadir}/%{name}/
|
||||
echo "%dir %{_datadir}/%{name}" >>file-lists/common_list.txt
|
||||
echo "%dir %{_datadir}/%{name}/program" >>file-lists/common_list.txt
|
||||
echo "%{_datadir}/%{name}/link-to-ooo-home" >>file-lists/common_list.txt
|
||||
################
|
||||
# helper script for noarch packages
|
||||
# add missing directories to the file list
|
||||
@ -972,45 +956,44 @@ echo "%dir %{_datadir}/application-registry" >>file-lists/common_list.txt
|
||||
echo "%dir %{_datadir}/mime-info" >>file-lists/common_list.txt
|
||||
echo "%dir %{_datadir}/mimelnk" >>file-lists/common_list.txt
|
||||
echo "%dir %{_datadir}/mimelnk/application" >>file-lists/common_list.txt
|
||||
################
|
||||
# common helpcontent files
|
||||
# create symlinks to %{_datadir} for noarch help packages
|
||||
mkdir -p %{buildroot}/%{_datadir}/%{lo_home}/help
|
||||
echo "%dir %{lo_prefix}/%{lo_home}/help" >>file-lists/common_list.txt
|
||||
echo "%dir %{_datadir}/%{lo_home}/help" >>file-lists/common_list.txt
|
||||
for file in idxcaption.xsl idxcontent.xsl main_transform.xsl ; do
|
||||
ln -sf %{lo_prefix}/%{lo_home}/help/$file %{buildroot}/%{_datadir}/%{lo_home}/help
|
||||
echo "%{lo_prefix}/%{lo_home}/help/$file" >>file-lists/common_list.txt
|
||||
echo "%{_datadir}/%{lo_home}/help/$file" >>file-lists/common_list.txt
|
||||
done
|
||||
|
||||
#################################
|
||||
# Move split noarch data to share
|
||||
#################################
|
||||
for i in %{buildroot}/%{_libdir}/%{lo_home}/share/config/soffice.cfg/modules/*/ui/res/*.zip \
|
||||
%{buildroot}/%{_libdir}/%{lo_home}/share/config/soffice.cfg/*/ui/res/*.zip \
|
||||
%{buildroot}/%{_libdir}/%{lo_home}/share/registry/res/fcfg_langpack_*.xcd \
|
||||
%{buildroot}/%{_libdir}/%{lo_home}/share/registry/res/registry_*.xcd \
|
||||
%{buildroot}/%{_libdir}/%{lo_home}/share/registry/Langpack-*.xcd \
|
||||
%{buildroot}/%{_libdir}/%{lo_home}/program/resource/*.res \
|
||||
%{buildroot}%{_libdir}/%{lo_home}/share/config/images*.zip \
|
||||
for i in %{buildroot}%{_libdir}/%{name}/share/config/soffice.cfg/modules/*/ui/res/*.zip \
|
||||
%{buildroot}%{_libdir}/%{name}/share/config/soffice.cfg/*/ui/res/*.zip \
|
||||
%{buildroot}%{_libdir}/%{name}/share/registry/res/fcfg_langpack_*.xcd \
|
||||
%{buildroot}%{_libdir}/%{name}/share/registry/res/registry_*.xcd \
|
||||
%{buildroot}%{_libdir}/%{name}/share/registry/Langpack-*.xcd \
|
||||
%{buildroot}%{_libdir}/%{name}/program/resource/*.res \
|
||||
%{buildroot}%{_libdir}/%{name}/share/config/images*.zip \
|
||||
%{buildroot}%{_libdir}/%{name}/share/registry/{cjk,ctl}_*.xcd \
|
||||
; do
|
||||
trg="`dirname "$i" | sed 's|%{_libdir}|%{_datadir}|'`"
|
||||
mkdir -p "$trg"
|
||||
mv "$i" "$trg"
|
||||
done
|
||||
# help files are luckily in just one folder
|
||||
mkdir -p %{buildroot}/%{_datadir}/%{name}/help/
|
||||
echo "%dir %{_datadir}/%{name}/help" >>file-lists/common_list.txt
|
||||
mv %{buildroot}/%{_datadir}/%{name}/help/ %{buildroot}/%{_datadir}%{name}
|
||||
ln -s %{_datadir}/%{name}/help/ %{buildroot}/%{_libdir}/%{name}/help
|
||||
echo "%{_libdir}/%{name}/help" >> file-lists/common_list.txt
|
||||
for file in idxcaption.xsl idxcontent.xsl main_transform.xsl ; do
|
||||
echo "%{_datadir}/%{name}/help/$file" >> file-lists/common_list.txt
|
||||
done
|
||||
|
||||
################
|
||||
# branding split
|
||||
################
|
||||
# first check wheter the prebuilt sofficerc is still the same
|
||||
if ! diff %{buildroot}%{lo_prefix}/%{lo_home}/program/sofficerc $RPM_SOURCE_DIR/sofficerc-upstream ; then
|
||||
if ! diff %{buildroot}%{_libdir}/%{name}/program/sofficerc $RPM_SOURCE_DIR/sofficerc-upstream ; then
|
||||
echo "Error: The file \"sofficerc\" has changed in the sources"
|
||||
echo " Please, update the prebuilt variant in $RPM_SOURCE_DIR/sofficerc-upstream"
|
||||
exit 1;
|
||||
fi
|
||||
# create symlinks for all brandings to noarch pkg
|
||||
mkdir -p %{buildroot}/%{_datadir}/%{lo_home}/program/shell
|
||||
mkdir -p %{buildroot}/%{_datadir}/%{name}/program/shell
|
||||
for file in sofficerc \
|
||||
intro.png \
|
||||
flat_logo.svg \
|
||||
@ -1020,19 +1003,19 @@ for file in sofficerc \
|
||||
shell/backing_rtl_left.png \
|
||||
shell/backing_rtl_right.png \
|
||||
shell/backing_space.png ; do
|
||||
rm -f %{buildroot}/%{lo_prefix}/%{lo_home}/program/$file
|
||||
ln -sf %{_datadir}/%{lo_home}/program/$file %{buildroot}/%{lo_prefix}/%{lo_home}/program/$file
|
||||
rm -f %{buildroot}/%{_libdir}/%{name}/program/$file
|
||||
ln -sf %{_datadir}/%{name}/program/$file %{buildroot}/%{_libdir}/%{name}/program/$file
|
||||
# touch the target file to make brp-symlink happy; the touched files are not packaged
|
||||
# it would be possible to disable the error using NO_BRP_STALE_LINK_ERROR=yes but the check is pretty useful to catch other errors
|
||||
touch %{buildroot}/%{_datadir}/%{lo_home}/program/$file
|
||||
touch %{buildroot}/%{_datadir}/%{name}/program/$file
|
||||
done
|
||||
|
||||
################
|
||||
# FIXME: fast hack to solve a customer issue, n#364523
|
||||
# we need a more generic solution
|
||||
# FIXME: can be done better, see how fedora does it and imitate
|
||||
ln -sf acor_fr-FR.dat %{buildroot}%{lo_prefix}/%{lo_home}/share/autocorr/acor_fr-CA.dat
|
||||
echo "%{lo_prefix}/%{lo_home}/share/autocorr/acor_fr-CA.dat" >>file-lists/common_list.txt
|
||||
ln -sf acor_fr-FR.dat %{buildroot}%{_libdir}/%{name}/share/autocorr/acor_fr-CA.dat
|
||||
echo "%{_libdir}/%{name}/share/autocorr/acor_fr-CA.dat" >>file-lists/common_list.txt
|
||||
|
||||
# Symlink uno.py and unohelper.py so that python can find them
|
||||
mkdir -p %{buildroot}%{python_sitelib}
|
||||
@ -1046,7 +1029,7 @@ ln -s %{_libdir}/libreoffice/program/unohelper.py %{buildroot}%{python_sitelib}/
|
||||
# do not crate cache for bundled extensions because it is not secure
|
||||
# rather remove it (fdo#53006, fdo#51252, bnc#769448)
|
||||
# Remove after 12.2 is out of support/migration scope.
|
||||
bundled_cache="%{lo_prefix}/%{lo_home}/share/prereg/bundled"
|
||||
bundled_cache="%{_libdir}/%{name}/share/prereg/bundled"
|
||||
test -d "$bundled_cache" && rm -rf "$bundled_cache"/* || true;
|
||||
|
||||
%post
|
||||
@ -1056,7 +1039,7 @@ test -d "$bundled_cache" && rm -rf "$bundled_cache"/* || true;
|
||||
%icon_theme_cache_post
|
||||
|
||||
%preun
|
||||
test "$1" = "0" && rm -rf ./%{lo_prefix}/%{lo_home}/share/uno_packages/cache || true
|
||||
test "$1" = "0" && rm -rf ./%{_libdir}/%{name}/share/uno_packages/cache || true
|
||||
|
||||
%postun
|
||||
/sbin/ldconfig
|
||||
@ -1103,11 +1086,11 @@ test "$1" = "0" && rm -rf ./%{lo_prefix}/%{lo_home}/share/uno_packages/cache ||
|
||||
%files -f file-lists/common_list.txt
|
||||
%defattr(-,root,root)
|
||||
# ignore helper files for brp-symlink check
|
||||
%exclude %{_datadir}/%{lo_home}/program/sofficerc
|
||||
%exclude %{_datadir}/%{lo_home}/program/flat_logo.svg
|
||||
%exclude %{_datadir}/%{lo_home}/program/*.png
|
||||
%exclude %{_datadir}/%{lo_home}/program/shell/*.png
|
||||
%exclude %{_datadir}/%{lo_home}/program/shell/*.svg
|
||||
%exclude %{_datadir}/%{name}/program/sofficerc
|
||||
%exclude %{_datadir}/%{name}/program/flat_logo.svg
|
||||
%exclude %{_datadir}/%{name}/program/*.png
|
||||
%exclude %{_datadir}/%{name}/program/shell/*.png
|
||||
%exclude %{_datadir}/%{name}/program/shell/*.svg
|
||||
# such a big icons are not provided by other packages
|
||||
# FIXME: last time checked on openSUSE-12.2
|
||||
%dir %{_datadir}/icons/hicolor/512x512
|
||||
@ -1161,57 +1144,54 @@ test "$1" = "0" && rm -rf ./%{lo_prefix}/%{lo_home}/share/uno_packages/cache ||
|
||||
%files -f file-lists/sdk_doc_list.txt sdk-doc
|
||||
%defattr(-,root,root)
|
||||
|
||||
%files base-extensions
|
||||
%defattr(-,root,root)
|
||||
|
||||
%files base-drivers-mysql
|
||||
%defattr(-,root,root)
|
||||
%{lo_prefix}/%{lo_home}/share/extensions/mysql-connector-ooo
|
||||
%{_libdir}/%{name}/share/extensions/mysql-connector-ooo
|
||||
|
||||
%files calc-extensions
|
||||
%defattr(-,root,root)
|
||||
%{lo_prefix}/%{lo_home}/share/extensions/ConvertTextToNumber
|
||||
%{lo_prefix}/%{lo_home}/share/extensions/nlpsolver
|
||||
%{lo_prefix}/%{lo_home}/share/extensions/numbertext
|
||||
%{_libdir}/%{name}/share/extensions/ConvertTextToNumber
|
||||
%{_libdir}/%{name}/share/extensions/nlpsolver
|
||||
%{_libdir}/%{name}/share/extensions/numbertext
|
||||
|
||||
%files writer-extensions
|
||||
%defattr(-,root,root)
|
||||
%{lo_prefix}/%{lo_home}/share/extensions/gdocs
|
||||
%{lo_prefix}/%{lo_home}/share/extensions/wiki-publisher
|
||||
%{_libdir}/%{name}/share/extensions/gdocs
|
||||
%{_libdir}/%{name}/share/extensions/wiki-publisher
|
||||
|
||||
%files -n libreoffice-icon-theme-crystal
|
||||
%defattr(-,root,root)
|
||||
%dir %{_datadir}/%{lo_home}
|
||||
%dir %{_datadir}/%{lo_home}/share
|
||||
%dir %{_datadir}/%{lo_home}/share/config
|
||||
%{_datadir}/%{lo_home}/share/config/images_crystal.zip
|
||||
%dir %{_datadir}/%{name}
|
||||
%dir %{_datadir}/%{name}/share
|
||||
%dir %{_datadir}/%{name}/share/config
|
||||
%{_datadir}/%{name}/share/config/images_crystal.zip
|
||||
|
||||
%files -n libreoffice-icon-theme-galaxy
|
||||
%defattr(-,root,root)
|
||||
%dir %{_datadir}/%{lo_home}
|
||||
%dir %{_datadir}/%{lo_home}/share
|
||||
%dir %{_datadir}/%{lo_home}/share/config
|
||||
%{_datadir}/%{lo_home}/share/config/images.zip
|
||||
%dir %{_datadir}/%{name}
|
||||
%dir %{_datadir}/%{name}/share
|
||||
%dir %{_datadir}/%{name}/share/config
|
||||
%{_datadir}/%{name}/share/config/images.zip
|
||||
|
||||
%files -n libreoffice-icon-theme-hicontrast
|
||||
%defattr(-,root,root)
|
||||
%dir %{_datadir}/%{lo_home}
|
||||
%dir %{_datadir}/%{lo_home}/share
|
||||
%dir %{_datadir}/%{lo_home}/share/config
|
||||
%{_datadir}/%{lo_home}/share/config/images_hicontrast.zip
|
||||
%dir %{_datadir}/%{name}
|
||||
%dir %{_datadir}/%{name}/share
|
||||
%dir %{_datadir}/%{name}/share/config
|
||||
%{_datadir}/%{name}/share/config/images_hicontrast.zip
|
||||
|
||||
%files -n libreoffice-icon-theme-oxygen
|
||||
%defattr(-,root,root)
|
||||
%dir %{_datadir}/%{lo_home}
|
||||
%dir %{_datadir}/%{lo_home}/share
|
||||
%dir %{_datadir}/%{lo_home}/share/config
|
||||
%{_datadir}/%{lo_home}/share/config/images_oxygen.zip
|
||||
%dir %{_datadir}/%{name}
|
||||
%dir %{_datadir}/%{name}/share
|
||||
%dir %{_datadir}/%{name}/share/config
|
||||
%{_datadir}/%{name}/share/config/images_oxygen.zip
|
||||
|
||||
%files -n libreoffice-icon-theme-tango
|
||||
%defattr(-,root,root)
|
||||
%dir %{_datadir}/%{lo_home}
|
||||
%dir %{_datadir}/%{lo_home}/share
|
||||
%dir %{_datadir}/%{lo_home}/share/config
|
||||
%{_datadir}/%{lo_home}/share/config/images_tango.zip
|
||||
%dir %{_datadir}/%{name}
|
||||
%dir %{_datadir}/%{name}/share
|
||||
%dir %{_datadir}/%{name}/share/config
|
||||
%{_datadir}/%{name}/share/config/images_tango.zip
|
||||
|
||||
%changelog
|
||||
|
120
link-to-ooo-home
120
link-to-ooo-home
@ -1,59 +1,83 @@
|
||||
#! /bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "This script (un)links or unlinks the given to/from OOo home"
|
||||
usage() {
|
||||
echo "This script (un)links or unlinks the given to/from libreoffice home"
|
||||
echo
|
||||
echo "Usage: ${0##*/} [--unlink] filelist"
|
||||
}
|
||||
|
||||
datadir=/usr/share
|
||||
# FIXME: It is hard to predict if 32-bit or 64-bit OOo is installed on x86_64
|
||||
libdir_list="/usr/lib"
|
||||
if test "`uname -m`" = "x86_64" ; then
|
||||
libdir_list="$libdir_list /usr/lib64"
|
||||
fi
|
||||
change_linking() {
|
||||
local libdir="$1"
|
||||
local filelist="$2"
|
||||
local linkfile=""
|
||||
local linkdir=""
|
||||
|
||||
|
||||
if test "$1" = "--unlink" ; then
|
||||
link_mode=false
|
||||
shift
|
||||
else
|
||||
link_mode=true
|
||||
fi
|
||||
|
||||
test "$1" = "--help" && usage && exit 0
|
||||
test ! -f "$1" -o -n "$2" && usage && exit 1
|
||||
|
||||
filelist="$1"
|
||||
|
||||
|
||||
for libdir in $libdir_list ; do
|
||||
|
||||
if $link_mode ; then
|
||||
for dir in `grep "%dir" $filelist | sed "s|%dir ||"` ; do
|
||||
linkdir=`echo $dir | sed "s|$datadir|$libdir|"`
|
||||
mkdir -p $linkdir
|
||||
done
|
||||
# If we are starting up then create the folder structure first
|
||||
if ${link_mode}; then
|
||||
for dir in `grep "%dir" ${filelist} | sed "s|%dir ||"` ; do
|
||||
mkdir -p "${dir/${datadir}/${libdir}}"
|
||||
done
|
||||
fi
|
||||
|
||||
for file in `grep -v "%dir" $filelist | sed "s|%config ||"` ; do
|
||||
linkedfile=`echo $file | sed "s|$datadir|$libdir|"`
|
||||
if $link_mode ; then
|
||||
ln -sf $file $linkedfile
|
||||
else
|
||||
# do not remove still valid symlinks
|
||||
# they might have another meaning; they might be another package...
|
||||
test -L $linkedfile -a ! -r $linkedfile && rm -f $linkedfile
|
||||
fi
|
||||
# Create link for each regular file or prune the link if removing
|
||||
for file in `grep -v "%dir" ${filelist} | sed "s|%config ||"` ; do
|
||||
linkfile=${file/${datadir}/${libdir}}
|
||||
if ${link_mode}; then
|
||||
ln -sf "${file}" "${linkfile}" || exit 1
|
||||
else
|
||||
# remove only empty (broken links)
|
||||
# there might be multiple deps providing the same
|
||||
if [[ -L "${linkfile}" && ! -r "${linfile}" ]]; then
|
||||
rm -f "${linkfile}" || exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Remove all empty dirs but validate if they do not belong
|
||||
# to some other pkg too
|
||||
if ! ${link_mode}; then
|
||||
for dir in `grep "%dir" ${filelist} | sed "s|%dir ||"` ; do
|
||||
linkdir="${dir/${datadir}/${libdir}}"
|
||||
# Check if dir is empty
|
||||
if [[ -d "${linkdir}" && -z `ls "${linkdir}"/*` ]]; then
|
||||
# check if nothing else owns the dir
|
||||
if [[ $(rpm -qf "${dir}" 2>/dev/null |wc -l) == 0 ]]; then
|
||||
rmdir "${linkdir}" || exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# FIXME: do not remove empty directories
|
||||
# they might be in another package that is not longer noarch, ...
|
||||
# if ! $link_mode ; then
|
||||
# for dir in `grep "%dir" $filelist | sed "s|%dir ||" | sort -r` ; do
|
||||
# linkdir=`echo $dir | sed "s|$datadir|$libdir|"`
|
||||
# rmdir $linkdir 2>/dev/null || true
|
||||
# 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
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user