From 3993b1ff9fa06ffe575c1bb810d40dec3710b2a208ed372ab410fc48d0a0e11f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Tue, 28 Jan 2014 09:26:01 +0000 Subject: [PATCH] Ensure we do not override already existing data. OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=96 --- link-to-ooo-home | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/link-to-ooo-home b/link-to-ooo-home index a477fdd..cc2f4bd 100644 --- a/link-to-ooo-home +++ b/link-to-ooo-home @@ -19,10 +19,19 @@ change_linking() { # if we get ourselves folder then just create it # it might not be around so lets be safe if [[ -d "${file}" ]] ; then - mkdir -p "${dir/${datadir}/${libdir}}" + dirname="${dir/${datadir}/${libdir}}" + # if the location is already there skip it + if [[ ! -e "${dirname}" ]]; then + mkdir -p "${dirname}" + fi continue fi - ln -sf "${file}" "${file/${datadir}/${libdir}}" || exit 1 + linkfile="${file/${datadir}/${libdir}}" + # if the file is already there, skip it + # this is true when the parent folder is link + if [[ ! -e "${linfile}" ]]; then + ln -sf "${file}" "${linfile}" || exit 1 + fi done else # first just remove the symlinks