File suse_update_desktop_file_kde3_new.sh of Package kdelibs3

#!/bin/bash

# suse_update_desktop_file.sh wrapper for KDE3.
# This script is provided due to removing of KDE3 path from suse_update_desktop_file.sh.

KDE3APPDIR=/opt/kde3/share/applications/kde/
KDE3APPLNKDIR=/opt/kde3/share/applnk/
KDE3DESKTOPEXT=.desktop
KDE3VALUEPARAMS=( "-d" "--docid" "-D" "--docpath" "-c" "--create" "-C" "--comment" "-N" "--name" "-G" "--genericname" )

args=()
while [ "${1:0:1}" = "-" ]; do
  args+=( "${1}" )

  IFS=$'\n'; echo "${KDE3VALUEPARAMS[*]}" | grep -x -- "${1}" > /dev/null
  if [ $? -lt 1 ]; then
    # value for parameter
    args+=( "${1}" )
    shift
  fi

  shift
done

# first parameter without hyphen is filename
if [ -e "${RPM_BUILD_ROOT}${KDE3APPDIR}${1}${KDE3DESKTOPEXT}" ]; then
  args+=( "${RPM_BUILD_ROOT}${KDE3APPDIR}${1}${KDE3DESKTOPEXT}" )
  shift
else
  APPLNKFILES=`find "${RPM_BUILD_ROOT}${KDE3APPLNKDIR}" -type f | grep ${1}${KDE3DESKTOPEXT}$`
  if [ $? -lt 1 ]; then
    # move KDE legacy files to XDG path
    echo "WARNING: file is in old KDE legacy path, moving it to XDG path"
    mkdir -p ${RPM_BUILD_ROOT}${KDE3APPDIR}
    for i in ${APPLNKFILES}; do
      mv $i "${RPM_BUILD_ROOT}${KDE3APPDIR}${1}${KDE3DESKTOPEXT}"
    done

    args+=( "${RPM_BUILD_ROOT}${KDE3APPDIR}${1}${KDE3DESKTOPEXT}" )
  else
    args+=( "${1}" )
  fi

  shift
fi

while [ "${1}" ]; do
  args+=( "${1}" )
  shift
done

exec /usr/lib/rpm/suse_update_desktop_file.sh "${args[@]}"