Message: previous - next
Month: November 2011

Re: [trinity-devel] Migrating kde3 profile

From: Darrell Anderson <humanreadable@...>
Date: Thu, 17 Nov 2011 11:39:06 -0800 (PST)
At one time I had submitted code to attempt a profile directory migration from within in startkde.

Here is the snippet. Probably needs some more error checking!

if [ -n "$KDEHOME" ]; then
  echo "[startkde] KDEHOME is preset to $KDEHOME." 1>&2
  # $KDEHOME is NOT already preset in the environment. Try to help.
  # This might be overkill but does provide flexibility.
  echo "[startkde] KDEHOME is not set." 1>&2
  # This script and kstandardirs.h and kstandardirs.cpp must match.
  # The latter two must be edited/patched before compiling.
  export KDEHOME=$HOME/.trinity
  echo "[startkde] Set KDEHOME to $KDEHOME." 1>&2
  # This is a feeble attempt to migrate a KDE3 profile to Trinity. If $HOME/.trinity exists
  # then skip this one-time migration section.
  if [ ! -d $HOME/.trinity ]; then
    if [ -d $HOME/.kde3 ]; then
      # If $HOME/.kde3 exists, probably safe to presume a profile from KDE3 or a previous Trinity.
      # Go ahead and migrate that profile.
      cp -a $HOME/.kde3 $HOME/.trinity
    elif [ -d $HOME/.kde ]; then
      # This is tricky --- ensure this profile directory is NOT KDE4.
      if [ ! -f $HOME/.kde/share/config/nepomukstrigirc ] && [ ! -f $HOME/.kde/share/config/phonondevicerc ] && [ ! -f $HOME/.kde/share/config/plasma-desktoprc ]; then
        # That was three different tests. Probably not a KDE4 profile. There is a chance
        # the user's KDE3 profile got contaminated testing KDE4. If that is the case then
        # too bad. The safe route is not to migrate. Otherwise if this 3-point test passes
        # then migrate the profile.
        cp -a $HOME/.kde $HOME/.trinity

        # Let's remove any KDE3 "contamination."

        rm -fr ~/.trinity/cache-*
        rm -fr ~/.trinity/socket-*
        rm -fr ~/.trinity/tmp-*

        # Need to fix the following lines with the correct path for the old KDE profile directory!
        find ~/.trinity -path ~/.trinity/share/apps/kmail/mail -prune -o -type f -exec sed -i 's|/\.kde3|/\.trinity|g' {} \;
        find ~/.trinity -path ~/.trinity/share/apps/kmail/mail -prune -o -type f -exec sed -i 's|/opt/kde3/|/opt/trinity/|g' {} \;
        find ~/.trinity -path ~/.trinity/share/apps/kmail/mail -prune -o -type f -exec sed -i 's|/usr/share/|/opt/trinity/share/|g' {} \;

        # Need to fix certain config files! The previous find command should fix such config files.
        # kpatrc (KPatience); change /usr/share to $PREFIX/share
        # Back=/usr/share/apps/carddecks/decks/deck2.png
        # Cards=/usr/share/apps/carddecks/cards-default/

        # Need a way to update sym links in ~/.trinity/Autostart!

        # etc.!

In this post I added the cleanup commands I posted earlier and comments for additional migration support. This snippet needs more work and is posted only as a starter.