# Save old config files:
# if [ ! -L etc/X11/tdm ]; then
#   if [ -d etc/X11/tdm ]; then
#     mkdir -p etc/trinity/tdm
#     cp -a etc/X11/tdm/* etc/trinity/tdm
#     rm -rf etc/X11/tdm
#     ( cd etc/X11 ; ln -sf /etc/trinity/tdm tdm )
#   fi
# elif [ ! -e etc/X11/tdm ]; then
#   mkdir -p etc/X11
#   ( cd etc/X11 ; ln -sf /etc/trinity/tdm tdm )
# fi

# Use new xwmconfig but save the original
mv /usr/bin/xwmconfig /usr/bin/xwmconfig.orig
mv /usr/bin/xwmconfig.new /usr/bin/xwmconfig

#!/bin/sh
config() {
  NEW="$1"
  OLD="`dirname $NEW`/`basename $NEW .new`"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}
config etc/trinity/tdm/tdmrc.new
config etc/trinity/tdm/backgroundrc.new
config etc/X11/xinit/xinitrc.trinity.new
config etc/profile.d/trinity.sh.new
# config etc/profile.d/trinity.csh.new
# config /usr/bin/starttde.new
# config /usr/bin/starttde

if [ -x /sbin/ldconfig ]; then
  /sbin/ldconfig 2> /dev/null
fi
( cd usr/bin ; rm -rf kinfocenter )
( cd usr/bin ; ln -sf kcontrol kinfocenter )
( cd usr/share/config ; rm -rf tdm )
( cd usr/share/config ; ln -sf ../../../../etc/trinity/tdm tdm )
( cd usr/lib/trinity/plugins/integration ; rm -rf libqtkde.so.0 )
( cd usr/lib/trinity/plugins/integration ; ln -sf libqtkde.so.0.0.0 libqtkde.so.0 )
( cd usr/lib/trinity/plugins/integration ; rm -rf libqtkde.so )
( cd usr/lib/trinity/plugins/integration ; ln -sf libqtkde.so.0 libqtkde.so )
( cd usr/lib ; rm -rf libkonq.so.4 )
( cd usr/lib ; ln -sf libkonq.so.4.2.0 libkonq.so.4 )
( cd usr/lib ; rm -rf libkonq.so )
( cd usr/lib ; ln -sf libkonq.so.4 libkonq.so )
( cd usr/lib ; rm -rf libkfontinst.so.0 )
( cd usr/lib ; ln -sf libkfontinst.so.0.0.0 libkfontinst.so.0 )
( cd usr/lib ; rm -rf libkfontinst.so )
( cd usr/lib ; ln -sf libkfontinst.so.0 libkfontinst.so )
( cd usr/lib ; rm -rf libtdecorations.so.1 )
( cd usr/lib ; ln -sf libtdecorations.so.1.0.0 libtdecorations.so.1 )
( cd usr/lib ; rm -rf libtdecorations.so )
( cd usr/lib ; ln -sf libtdecorations.so.1 libtdecorations.so )
( cd usr/lib ; rm -rf libkateutils.so.0 )
( cd usr/lib ; ln -sf libkateutils.so.0.0.0 libkateutils.so.0 )
( cd usr/lib ; rm -rf libkateutils.so )
( cd usr/lib ; ln -sf libkateutils.so.0 libkateutils.so )
( cd usr/lib ; rm -rf libkateinterfaces.so.0 )
( cd usr/lib ; ln -sf libkateinterfaces.so.0.0.0 libkateinterfaces.so.0 )
( cd usr/lib ; rm -rf libkateinterfaces.so )
( cd usr/lib ; ln -sf libkateinterfaces.so.0 libkateinterfaces.so )
( cd usr/lib ; rm -rf libkonqsidebarplugin.so.1 )
( cd usr/lib ; ln -sf libkonqsidebarplugin.so.1.2.0 libkonqsidebarplugin.so.1 )
( cd usr/lib ; rm -rf libkonqsidebarplugin.so )
( cd usr/lib ; ln -sf libkonqsidebarplugin.so.1 libkonqsidebarplugin.so )
( cd usr/lib ; rm -rf libkickermain.so.1 )
( cd usr/lib ; ln -sf libkickermain.so.1.0.0 libkickermain.so.1 )
( cd usr/lib ; rm -rf libkickermain.so )
( cd usr/lib ; ln -sf libkickermain.so.1 libkickermain.so )
( cd usr/lib ; rm -rf libtaskmanager.so.1 )
( cd usr/lib ; ln -sf libtaskmanager.so.1.0.0 libtaskmanager.so.1 )
( cd usr/lib ; rm -rf libtaskmanager.so )
( cd usr/lib ; ln -sf libtaskmanager.so.1 libtaskmanager.so )
( cd usr/lib ; rm -rf libtaskbar.so.1 )
( cd usr/lib ; ln -sf libtaskbar.so.1.2.0 libtaskbar.so.1 )
( cd usr/lib ; rm -rf libtaskbar.so )
( cd usr/lib ; ln -sf libtaskbar.so.1 libtaskbar.so )
( cd usr/lib ; rm -rf libkickoffsearch_interfaces.so.0 )
( cd usr/lib ; ln -sf libkickoffsearch_interfaces.so.0.0.0 libkickoffsearch_interfaces.so.0 )
( cd usr/lib ; rm -rf libkickoffsearch_interfaces.so )
( cd usr/lib ; ln -sf libkickoffsearch_interfaces.so.0 libkickoffsearch_interfaces.so )
( cd usr/lib ; rm -rf libkasbar.so.1 )
( cd usr/lib ; ln -sf libkasbar.so.1.0.0 libkasbar.so.1 )
( cd usr/lib ; rm -rf libkasbar.so )
( cd usr/lib ; ln -sf libkasbar.so.1 libkasbar.so )
( cd usr/lib ; rm -rf libksplashthemes.so.0 )
( cd usr/lib ; ln -sf libksplashthemes.so.0.0.0 libksplashthemes.so.0 )
( cd usr/lib ; rm -rf libksplashthemes.so )
( cd usr/lib ; ln -sf libksplashthemes.so.0 libksplashthemes.so )
( cd usr/lib ; rm -rf libkhotkeys_shared.so.1 )
( cd usr/lib ; ln -sf libkhotkeys_shared.so.1.0.0 libkhotkeys_shared.so.1 )
( cd usr/lib ; rm -rf libkhotkeys_shared.so )
( cd usr/lib ; ln -sf libkhotkeys_shared.so.1 libkhotkeys_shared.so )
( cd usr/lib ; rm -rf libksgrd.so.1 )
( cd usr/lib ; ln -sf libksgrd.so.1.2.0 libksgrd.so.1 )
( cd usr/lib ; rm -rf libksgrd.so )
( cd usr/lib ; ln -sf libksgrd.so.1 libksgrd.so )
