Numerous improvements from original snippets originally inserted in starttde. Added migratekde3 shell script to migrate existing KDE3 profiles to Trinity profiles, thereby closing bug report 709.pull/2/head
parent
5464fc6fc6
commit
6ebf92cb8e
@ -0,0 +1,295 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Overall, this script works quite nicely, but please help to
|
||||
# make this script more robust!
|
||||
|
||||
# Testers: need help to ensure this script remains POSIX compliant.
|
||||
# Some distros do not use bash as a default shell.
|
||||
|
||||
#===============================================================
|
||||
# This is a modest attempt to migrate a KDE3 profile to Trinity.
|
||||
# If $HOME/.trinity exists then skip this one-time migration.
|
||||
|
||||
# Can this script be run from within starttde?
|
||||
# Challenge: to run this script from within starttde requires
|
||||
# graphical dialog boxes. When is the underlying TDE system
|
||||
# sufficiently operational in the starttde script to use KDialog?
|
||||
# If KDialog is unavailable then that leaves xmessage, which is
|
||||
# ugly although possibly adequate.
|
||||
|
||||
# If KDialog is unavailable until after $HOME/.trinity exists, such
|
||||
# as after running KPersonalizer, then this script will not help.
|
||||
# Also, KPersonalizer automatically creates a skeleton profile directory
|
||||
# when launched, as does some command line tools such as kconf_update.
|
||||
#
|
||||
# Additionally, this script was written mainly from a command line
|
||||
# login perspective. This script and concept needs testing and
|
||||
# improvements to support graphical login systems.
|
||||
|
||||
#===============================================================
|
||||
# Known Quirks:
|
||||
# When testing the same user account between two different systems, such
|
||||
# as a real and virtual machine or two different physical machines,
|
||||
# after a migration KMix is always muted because the sound devices differ.
|
||||
|
||||
# Not sure, but forced window sizes saved in kwinrulesc seem to break after
|
||||
# a migration.
|
||||
#===============================================================
|
||||
|
||||
Wait_For_Response () {
|
||||
unset response
|
||||
# -r Backslash does not act as an escape character.
|
||||
# -p Display "PROMPT" without a trailing newline, before attempting to read any input.
|
||||
while true; do
|
||||
read -r -p "$1 (y/n): " yn
|
||||
case $yn in
|
||||
[Yy]* ) response=y; break;;
|
||||
[Nn]* ) response=n; break;;
|
||||
* ) echo "Please answer yes (y/Y) or no (n/N).";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
Proceed_From_Response () {
|
||||
if [ "$response" = "n" -o "$response" = "N" ]; then
|
||||
echo "Exiting."
|
||||
echo
|
||||
exit 0
|
||||
else
|
||||
echo "Continuing."
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
# Need help here to make the disk space test more robust!
|
||||
disk_space_test () {
|
||||
echo
|
||||
echo "Testing available disk space."
|
||||
# Find the remaining space on the partition.
|
||||
AVAILABLE="`df $HOME/$KDE3_PROFILE | grep '\/' | awk '{print $4}'`"
|
||||
# Find the size of the profile directory.
|
||||
PROFILE_SIZE="`du -s $HOME/$KDE3_PROFILE | awk '{print $1}'`"
|
||||
# Determine remaining partition space after migrating.
|
||||
REMAINING_SPACE=$(($AVAILABLE - $PROFILE_SIZE))
|
||||
# Convert to human friendly numbers (MBs).
|
||||
PROFILE_SIZE="`echo \"${PROFILE_SIZE} / 1024\" | bc`"
|
||||
REMAINING_SPACE="`echo \"$REMAINING_SPACE / 1024\" | bc`"
|
||||
# Let the user know the results.
|
||||
echo "Remaining disk space: ${REMAINING_SPACE} MB"
|
||||
echo "Space required for new profile: ${PROFILE_SIZE} MB"
|
||||
# If obvious insufficient space then inform and quit.
|
||||
if [ $PROFILE_SIZE -gt $REMAINING_SPACE ]; then
|
||||
echo "Insufficient disk space. Exiting."
|
||||
exit 0
|
||||
fi
|
||||
# Ask whether to proceed.
|
||||
Wait_For_Response "Migrate?"
|
||||
Proceed_From_Response
|
||||
# User wants to migrate.
|
||||
echo "Migrating an existing KDE3 profile directory:" 1>&2
|
||||
echo "This is a one-time event." 1>&2
|
||||
echo "Copying \$HOME/$KDE3_PROFILE to \$HOME/.trinity." 1>&2
|
||||
cp -a $HOME/$KDE3_PROFILE $HOME/.trinity
|
||||
}
|
||||
|
||||
# Avoid any possible conflict with KDE4. Therefore within this script
|
||||
# use full path names to all binaries used.
|
||||
|
||||
# The binaries for TDE are located in the same place as this script.
|
||||
# To determine that location use the following method rather than presuming
|
||||
# the existence of $TDEDIR. That environment variable might not be
|
||||
# defined or defined to point to KDE4 binaries.
|
||||
BIN_DIR="`dirname \`readlink -f $0\``"
|
||||
if [ -x $BIN_DIR/tde-config ]; then
|
||||
TDE_VERSION="`$BIN_DIR/tde-config --version | grep TDE | awk '{print $2}'`"
|
||||
echo "Trinity Desktop Environment version is $TDE_VERSION" 1>&2
|
||||
export TDEDIR=${BIN_DIR%/bin}
|
||||
echo "Trinity Desktop Environment base directory is $TDEDIR" 1>&2
|
||||
else
|
||||
echo "Unable to determine TDE base directory."
|
||||
echo "This script should be installed in the same directory."
|
||||
echo "Exiting."
|
||||
exit 1
|
||||
fi
|
||||
unset BIN_DIR
|
||||
|
||||
echo
|
||||
echo "This script migrates an existing KDE3 profile directory."
|
||||
echo "The KDE3 profile directory will be copied/duplicated"
|
||||
echo "and then cleaned/scrubbed to remove remnants of KDE3."
|
||||
echo "KMail config files will be scrubbed but not the mail files."
|
||||
echo "The result is a new Trinity profile directory. :-)"
|
||||
echo
|
||||
|
||||
# We need to make this first test more robust. Some TDE tools create
|
||||
# a skeleton profile directory ($TDEHOME/share/config) with no files.
|
||||
# Thus, the mere existence of $HOME/.trinity will cause this script
|
||||
# to terminate despite an existing profile directory possibly being
|
||||
# nothing more than a skeleton. Possibly like the KDE4 profile directory
|
||||
# test below, we can test for several knowable TDE files that also don't
|
||||
# exist in KDE4. If those files don't exist then presume a skeleton
|
||||
# profile directory.
|
||||
# Do not migrate when $TDEHOME is a sym link to another profile directory.
|
||||
# Trinity should have full reign within its own profile directory
|
||||
# (limited to administrative locking), but an error check is a
|
||||
# conservative approach.
|
||||
TDEHOME_LINK="`readlink \"$HOME/.trinity\"`"
|
||||
if [ "$TDEHOME_LINK" != "" ]; then
|
||||
echo "Warning! The profile directory $HOME/.trinity is a" 1>&2
|
||||
echo "sym link to $TDEHOME_LINK!" 1>&2
|
||||
echo "Please break this sym link to perform the profile migration." 1>&2
|
||||
echo
|
||||
Wait_For_Response "Break the sym link now and continue with migrating?"
|
||||
Proceed_From_Response
|
||||
unlink "$HOME/.trinity" 2>/dev/null
|
||||
if [ "`readlink \"$HOME/.trinity\"`" != "" ]; then
|
||||
echo "Unable to break the sym link. Check your file and directory privileges. Quitting."
|
||||
unset KDE3_PROFILE
|
||||
unset TDEHOME_LINK
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
if [ -d "$HOME/.trinity" ]; then
|
||||
echo "$HOME/.trinity already exists." 1>&2
|
||||
echo "No migration required." 1>&2
|
||||
echo
|
||||
else
|
||||
echo "$HOME/.trinity does not exist." 1>&2
|
||||
if [ -d "$HOME/.kde3" ]; then
|
||||
# If $HOME/.kde3 exists, probably safe to presume a profile from KDE3 or a previous Trinity.
|
||||
echo "Found $HOME/.kde3."
|
||||
KDE3_PROFILE=".kde3"
|
||||
disk_space_test
|
||||
elif [ -d "$HOME/.kde" ]; then
|
||||
# This is tricky --- ensure this profile directory is NOT KDE4.
|
||||
echo "Found $HOME/.kde."
|
||||
if [ ! -d $HOME/.kde/share/kde4 ] && \
|
||||
[ ! -f $HOME/.kde/share/config/nepomukserverrc ] && \
|
||||
[ ! -f $HOME/.kde/share/config/phonondevicesrc ] && \
|
||||
[ ! -f $HOME/.kde/share/config/plasma-desktop-appletsrc ] && \
|
||||
[ ! -f $HOME/.kde/share/config/specialmailcollectionsrc ]; then
|
||||
# That was five 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 here is not to migrate. Otherwise if this 5-point
|
||||
# test passes then migrate the profile.
|
||||
KDE3_PROFILE=".kde"
|
||||
echo "$HOME/$KDE3_PROFILE does not look like a KDE4 profile directory."
|
||||
disk_space_test
|
||||
else
|
||||
echo "$HOME/.kde probably is a KDE4 profile directory."
|
||||
fi
|
||||
else
|
||||
echo "Found no KDE3 profile directory to migrate." 1>&2
|
||||
fi
|
||||
fi
|
||||
if [ -n "$KDE3_PROFILE" ]; then
|
||||
# Let's remove any KDE3 "contamination."
|
||||
echo "Removing KDE3 remnants from the new Trinity profile:" 1>&2
|
||||
echo "Removing cache and temp files." 1>&2
|
||||
rm -fr $HOME/.trinity/cache-*
|
||||
rm -fr $HOME/.trinity/socket-*
|
||||
rm -fr $HOME/.trinity/tmp-*
|
||||
# Need to fix config files.
|
||||
# Exclude KMail mail files --- we don't want to touch those files.
|
||||
# I'm using maildir --- do these commands work for mbox too?
|
||||
echo "Cleaning config files (but not KMail mail files. :-))" 1>&2
|
||||
echo "Cleaning, first pass..." 1>&2
|
||||
find $HOME/.trinity -path $HOME/.trinity/share/apps/kmail/mail -prune -o -type f -exec sed -i "s|/${KDE3_PROFILE}|/\.trinity|g" {} \;
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "Done." 1>&2
|
||||
else
|
||||
echo "There was an error with the first pass." 1>&2
|
||||
fi
|
||||
# What if $TDEDIR is not defined? Bummer.
|
||||
if [ -z "$TDEDIR" ]; then
|
||||
echo "The \$TDEDIR environment variable does not exist. Can't complete the cleanup." 1>&2
|
||||
else
|
||||
echo "Cleaning, second pass..." 1>&2
|
||||
find $HOME/.trinity -path $HOME/.trinity/share/apps/kmail/mail -prune -o -type f -exec sed -i "s|/opt/kde3/|${TDEDIR}/|g" {} \;
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "Done." 1>&2
|
||||
else
|
||||
echo "There was an error with the second pass." 1>&2
|
||||
fi
|
||||
echo "Cleaning, third pass..." 1>&2
|
||||
# Prevent an anomaly with the kicker Firefox icon. Firefox likely is installed to /usr.
|
||||
# The following update will change that to /opt/trinity. We need to restore that location.
|
||||
KICKER_FIREFOX="$HOME/$KDE3_PROFILE/share/apps/kicker/mozilla-firefox.desktop"
|
||||
if [ -e "$KICKER_FIREFOX" ]; then
|
||||
FIREFOX_PNG_LOCATION="`grep \"Icon=\" \"$KICKER_FIREFOX\"`"
|
||||
fi
|
||||
find $HOME/.trinity -path $HOME/.trinity/share/apps/kmail/mail -prune -o -type f -exec sed -i "s|/usr/share/|${TDEDIR}/share/|g" {} \;
|
||||
if [ "$?" = "0" ]; then
|
||||
if [ "$FIREFOX_PNG_LOCATION" != "" ]; then
|
||||
FIREFOX_PNG_LOCATION_NEW="`grep \"Icon=\" \"$HOME/.trinity/share/apps/kicker/mozilla-firefox.desktop\"`"
|
||||
sed -i "s|$FIREFOX_PNG_LOCATION_NEW|$FIREFOX_PNG_LOCATION|" $HOME/.trinity/share/apps/kicker/mozilla-firefox.desktop
|
||||
fi
|
||||
echo "Done." 1>&2
|
||||
else
|
||||
echo "There was an error with the third pass." 1>&2
|
||||
fi
|
||||
fi
|
||||
# Need to update files in $HOME/.trinity/Autostart.
|
||||
# Some files might be *.desktop files and can be cleaned in place.
|
||||
# Some files might be sym links to a previous KDE3 location.
|
||||
# Recreate those links to the correct Trinity location.
|
||||
# This needs improvement for apps not in /usr/bin.
|
||||
echo "Attempting to update *.desktop files in Autostart." 1>&2
|
||||
find $HOME/.trinity/Autostart -! -type l -type f -exec sed -i "s|/usr/bin/|${TDEDIR}/bin/|g" {} \;
|
||||
echo "Attempting to update sym links in Autostart." 1>&2
|
||||
( cd $HOME/.trinity/Autostart
|
||||
for i in `find . -type l`; do
|
||||
LINK="`readlink $i`"
|
||||
echo "Found a sym link to $LINK." 1>&2
|
||||
LINK_PATH="`dirname $LINK`"
|
||||
LINK_NAME="`basename $LINK`"
|
||||
if [ -n "`echo $LINK_PATH | grep \"/usr\"`" ]; then
|
||||
echo "Sym link points to /usr." 1>&2
|
||||
NEW_LINK_PATH="`echo $LINK_PATH | sed \"s|/usr|${TDEDIR}|\"`"
|
||||
elif [ -n "`echo $LINK_PATH | grep \"/opt/kde\"`" ]; then
|
||||
echo "Sym link points to /opt/kde." 1>&2
|
||||
NEW_LINK_PATH="`echo $LINK_PATH | sed \"s|/opt/kde|${TDEDIR}|\"`"
|
||||
elif [ -n "`echo $LINK_PATH | grep \"/opt/kde3\"`" ]; then
|
||||
echo "Sym link points to /opt/kde3." 1>&2
|
||||
NEW_LINK_PATH="`echo $LINK_PATH | sed \"s|/opt/kde3|${TDEDIR}|\"`"
|
||||
else
|
||||
echo "Can't establish a path for a new link." 1>&2
|
||||
fi
|
||||
unlink $i
|
||||
echo "Attempting to create sym link to $NEW_LINK_PATH/$LINK_NAME." 1>&2
|
||||
ln -sf $NEW_LINK_PATH/$LINK_NAME $LINK_NAME
|
||||
if [ "$?" = "0" ]; then
|
||||
echo "Link created." 1>&2
|
||||
else
|
||||
echo "There was an error with creating the link." 1>&2
|
||||
fi
|
||||
done
|
||||
)
|
||||
echo "Renaming krita configuration files to chalk."
|
||||
mv $HOME/.trinity/share/config/kritarc $HOME/.trinity/share/config/chalkrc 2>/dev/null
|
||||
mv $HOME/.trinity/share/apps/krita $HOME/.trinity/share/apps/chalk 2>/dev/null
|
||||
rm -fr $HOME/.trinity/cache-`uname -n`/ksycoca* 2>/dev/null
|
||||
rm -fr $HOME/.trinity/socket-* 2>/dev/null
|
||||
rm -fr $HOME/.trinity/tmp-* 2>/dev/null
|
||||
rm -fr $TMP/kde-$USER 2>/dev/null
|
||||
rm -fr $TMP/ksocket-$USER 2>/dev/null
|
||||
rm -fr $TMP/tde-$USER 2>/dev/null
|
||||
rm -fr $TMP/tdesocket-$USER 2>/dev/null
|
||||
# Note: Don't run kconf_update, which is run automatically when starting TDE.
|
||||
# Note: Don't run any profile R14 updates: starttde does that through the r14-xdg-update script.
|
||||
echo
|
||||
echo "Migrated!" 1>&2
|
||||
echo
|
||||
fi
|
||||
|
||||
echo "If any button icons to non Trinity apps in the kicker/panel"
|
||||
echo "or system tray are incorrect, select the correct icon from the"
|
||||
echo "button's configure menu option. The button's path to the app should"
|
||||
echo "remain correct. (Note: please report any such anomalies.)"
|
||||
echo
|
||||
|
||||
unset KDE3_PROFILE
|
||||
unset TDEHOME_LINK
|
||||
unset KICKER_FIREFOX
|
||||
unset FIREFOX_PNG_LOCATION
|
||||
unset FIREFOX_PNG_LOCATION_NEW
|
@ -0,0 +1,215 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# A script to perform R14.0.0 XDG compliance updates.
|
||||
# This script should be needed to run only once.
|
||||
|
||||
# TODO: Do we need to trap whether the user is running this script while
|
||||
# in a Trinity session? Most files can be updated "live" but some can't,
|
||||
# such as kdeglobals.
|
||||
|
||||
# Allow forced execution of this script regardless of the kdeglobals setting.
|
||||
if [ "$1" = "force" ]; then
|
||||
FORCE="true"
|
||||
fi
|
||||
|
||||
# TODO: As the user should not be logged into a Trinity session when running
|
||||
# this script, or an administrator might run this script remotely, the
|
||||
# $TDEHOME variable probably is not set or knowable from within this script.
|
||||
# We presume $HOME/.trinity, but should provide a way to pass a command line
|
||||
# parameter to change that location.
|
||||
PROFILE_DIR="$HOME/.trinity"
|
||||
|
||||
# TODO: How to handle environments where files/directories are locked
|
||||
# administratively and can't be updated. The nominal validation checks
|
||||
# in this script provide some notice but no direct remedy.
|
||||
|
||||
Wait_For_Response () {
|
||||
unset response
|
||||
# -r Backslash does not act as an escape character.
|
||||
# -p Display "PROMPT" without a trailing newline, before attempting to read any input.
|
||||
while true; do
|
||||
read -r -p "$1 (y/n): " yn
|
||||
case $yn in
|
||||
[Yy]* ) response=y; break;;
|
||||
[Nn]* ) response=n; break;;
|
||||
* ) echo "Please answer yes (y/Y) or no (n/N).";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
Proceed_From_Response () {
|
||||
if [ "$response" = "n" -o "$response" = "N" ]; then
|
||||
echo "Exiting."
|
||||
echo
|
||||
exit 0
|
||||
else
|
||||
echo "Continuing."
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
Display_Message () {
|
||||
if [ "$DISPLAY" != "" ]; then
|
||||
echo -e "$MESSAGE" | xmessage -center -file - > /dev/null 2>/dev/null
|
||||
else
|
||||
echo -e "$MESSAGE"
|
||||
fi
|
||||
}
|
||||
|
||||
# Do not update when $TDEHOME is a sym link to another profile directory. Trinity should have
|
||||
# full reign within its own profile directory (limited to administrative locking), but the error
|
||||
# check is a conservative approach.
|
||||
TDEHOME_LINK="`readlink \"$PROFILE_DIR\"`"
|
||||
if [ "$TDEHOME_LINK" != "" ]; then
|
||||
# Force this entry to ensure the updates eventually are performed should the user copy the
|
||||
# original kdeglobals file into a new Trinity profile.
|
||||
$TDEDIR/bin/kwriteconfig --file kdeglobals --group "R14 XDG Updates" --key Updated --type bool 'false'
|
||||
# Are we in X? Display an X dialog explaining breakage.
|
||||
if [ "$DISPLAY" != "" ]; then
|
||||
echo "[r14-xdg-update] Warning! The profile directory $PROFILE_DIR is a" 1>&2
|
||||
echo "[r14-xdg-update] sym link to $TDEHOME_LINK!" 1>&2
|
||||
echo "[r14-xdg-update] R14 updates will not be performed because Trinity needs its own separate profile directory." 1>&2
|
||||
echo "[r14-xdg-update] Without R14 updates some Trinity apps will fail to function correctly." 1>&2
|
||||
fi
|
||||
MESSAGE="Oops! The profile directory $PROFILE_DIR is a sym link to $TDEHOME_LINK.\n\nTrinity R14 XDG compliance updates will not be performed because\nTrinity needs its own separate profile directory.\n\nWithout R14 XDG compliance updates, some Trinity apps will fail to\nfunction properly.\n\nFailures include the following:\n\n* Many left-side icon lists will not populate,\n such as the Panel and Konqueror configuration dialogs.\n\n* User-defined keyboard shortcuts fail (khotkeysrc).\n System defined shortcuts remain functional.\n\n* User-defined app preferences fail (profilerc).\n\n* Konqueror navigation/sidebar panel won't open.\n\n* User-defined konqueror service menus, kicker customization,\n konqueror sidebar, Recent Documents list fail.\n\nPossible remedies:\n\n* If necessary contact your system administrator.\n\n* Break the sym link to allow Trinity to create a fresh Trinity profile.\n\n* Use the migratekde3 script to migrate a KDE3 profile to Trinity."
|
||||
# Are we in X? Display an X dialog explaining breakage.
|
||||
if [ "$DISPLAY" != "" ]; then
|
||||
echo -e "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null
|
||||
if [ "$?" = "102" ]; then
|
||||
# User select the Quit button: quit this script.
|
||||
unset PROFILE_DIR
|
||||
unset TDEHOME_LINK
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo
|
||||
echo -e "$MESSAGE"
|
||||
echo
|
||||
Wait_For_Response "Break the sym link now and migrate the $TDEHOME_LINK profile to a new Trinity profile?"
|
||||
Proceed_From_Response
|
||||
unlink "$HOME/.trinity" 2>/dev/null
|
||||
if [ "`readlink \"$HOME/.trinity\"`" != "" ]; then
|
||||
echo "Unable to break the sym link. Check your file and directory privileges. Quitting."
|
||||
unset PROFILE_DIR
|
||||
unset TDEHOME_LINK
|
||||
exit 1
|
||||
else
|
||||
sh $TDEDIR/bin/migratekde3
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
R14_UPDATED="`$TDEDIR/bin/kreadconfig --file kdeglobals --group "R14 XDG Updates" --key Updated`"
|
||||
if [ "$R14_UPDATED" != "true" ] || [ "$FORCE" = "true" ]; then
|
||||
if [ "$DISPLAY" != "" ]; then
|
||||
echo -n "[r14-xdg-update] "
|
||||
fi
|
||||
echo -e "Performing a profile update for Trinity release R14 XDG compliance."
|
||||
if [ "$DISPLAY" != "" ]; then
|
||||
echo -n "[r14-xdg-update] "
|
||||
fi
|
||||
echo -e "Updating *.desktop files."
|
||||
find "$PROFILE_DIR" -name "*.desktop" -exec sed -i 's|X-KDE-|X-TDE-|g' {} \; 2>/dev/null
|
||||
find "$PROFILE_DIR" -name "*.desktop" -exec sed -i 's|KDE\;|TDE\;|g' {} \; 2>/dev/null
|
||||
if [ "$DISPLAY" != "" ]; then
|
||||
echo -n "[r14-xdg-update] "
|
||||
fi
|
||||
echo -e "Updating references of $TDEDIR/share/applications/kde to share/applications/tde."
|
||||
# Exclude KMail mail files --- we don't want to touch those files.
|
||||
find "$PROFILE_DIR" -path "$PROFILE_DIR/share/apps/kmail/mail" -prune -o -type f -exec sed -i "s|$TDEDIR/share/applications/kde|$TDEDIR/share/applications/tde|g" {} \; 2>/dev/null
|
||||
# Preserve keyboard shortcuts.
|
||||
if [ "$DISPLAY" != "" ]; then
|
||||
echo -n "[r14-xdg-update] "
|
||||
fi
|
||||
echo -e "Updating user-defined keyboard shortcuts in khotkeysrc."
|
||||
sed -i -e 's|CommandURL=kde-|CommandURL=tde-|g' -e 's|K Menu - kde-|K Menu - tde-|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
|
||||
# Preserve app preferences.
|
||||
if [ "$DISPLAY" != "" ]; then
|
||||
echo -n "[r14-xdg-update] "
|
||||
fi
|
||||
echo -e "Updating user-defined app prefernces in profilerc."
|
||||
sed -i -e 's|Application=kde-|Application=tde-|g' "$PROFILE_DIR/share/config/profilerc" 2>/dev/null
|
||||
# Preserve kicker/panel icons.
|
||||
if [ "$DISPLAY" != "" ]; then
|
||||
echo -n "[r14-xdg-update] "
|
||||
fi
|
||||
echo -e "Updating kicker/panel customizations in kickerrc."
|
||||
sed -i -e 's|StorageId\[\$e\]=kde-|StorageId\[\$e\]=tde-|g' "$PROFILE_DIR/share/config/kickerrc" 2>/dev/null
|
||||
# Update sym link files in $HOME/.trinity/Autostart.
|
||||
( cd "$PROFILE_DIR/Autostart"
|
||||
if [ "$DISPLAY" != "" ]; then
|
||||
echo -n "[r14-xdg-update] "
|
||||
fi
|
||||
echo "Updating Autostart files."
|
||||
for i in `find . -type l`; do
|
||||
LINK="`readlink $i`"
|
||||
LINK_PATH="`dirname $LINK`"
|
||||
LINK_NAME="`basename $LINK`"
|
||||
if [ -n "`echo $LINK_PATH | grep \"$TDEDIR/share/applications/kde\"`" ]; then
|
||||
NEW_LINK_PATH="`echo $LINK_PATH | sed 's|/share/applications/kde|/share/applications/tde|'`"
|
||||
fi
|
||||
unlink $i
|
||||
ln -sf $NEW_LINK_PATH/$LINK_NAME $LINK_NAME
|
||||
if [ "$?" != "0" ]; then
|
||||
if [ "$DISPLAY" != "" ]; then
|
||||
echo -n "[r14-xdg-update] "
|
||||
fi
|
||||
echo "There was an error with creating a new sym link for $LINK." 1>&2
|
||||
fi
|
||||
done
|
||||
)
|
||||
# Perform some nominal update validations.
|
||||
# This test includes *.desktop files in the profile Autostart directory.
|
||||
R14_UPDATE_TEST1="`find \"$PROFILE_DIR\" -name \"*.desktop\" -exec grep \"X-KDE\" {} \; 2>/dev/null`"
|
||||
if [ "$R14_UPDATE_TEST1" != "" ]; then
|
||||
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check *.desktop files for 'X-KDE'.)"
|
||||
Display_Message "$MESSAGE"
|
||||
fi
|
||||
R14_UPDATE_TEST2="`find \"$PROFILE_DIR\" -name \"*.desktop\" -exec grep -q \"KDE;\" {} \; 2>/dev/null`"
|
||||
if [ "$R14_UPDATE_TEST2" != "" ]; then
|
||||
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check *.desktop files for 'KDE;'.)"
|
||||
Display_Message "$MESSAGE"
|
||||
fi
|
||||
R14_UPDATE_TEST3="`find \"$PROFILE_DIR\" \"$PROFILE_DIR/share/apps/kmail/mail\" -prune -o -type f -exec grep -q \"$TDEDIR/share/applications/kde\" {} \; 2>/dev/null`"
|
||||
if [ "$R14_UPDATE_TEST3" != "" ]; then
|
||||
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check files for '$TDEDIR/share/applications/kde'.)"
|
||||
Display_Message "$MESSAGE"
|
||||
fi
|
||||
R14_UPDATE_TEST4="`grep -q \"CommandURL=kde-\" \"$PROFILE_DIR/share/config/khotkeysrc\" 2>/dev/null`"
|
||||
if [ "$R14_UPDATE_TEST4" != "" ]; then
|
||||
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check khotkeysrc for 'CommandURL=kde-'.)"
|
||||
Display_Message "$MESSAGE"
|
||||
fi
|
||||
R14_UPDATE_TEST5="`grep -q \"K Menu - kde-\" \"$PROFILE_DIR/share/config/khotkeysrc\" 2>/dev/null`"
|
||||
if [ "$R14_UPDATE_TEST5" != "" ]; then
|
||||
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check khotkeysrc for 'K Menu - kde-'.)"
|
||||
Display_Message "$MESSAGE"
|
||||
fi
|
||||
R14_UPDATE_TEST6="`grep -q \"Application=kde-\" \"$PROFILE_DIR/share/config/profilerc\" 2>/dev/null`"
|
||||
if [ "$R14_UPDATE_TEST6" != "" ]; then
|
||||
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check profilerc for 'Application=kde-'.)"
|
||||
Display_Message "$MESSAGE"
|
||||
fi
|
||||
R14_UPDATE_TEST7="`grep -q \"StorageId\[\$e\]=kde-\" \"$PROFILE_DIR/share/config/kickerrc\" 2>/dev/null`"
|
||||
if [ "$R14_UPDATE_TEST7" != "" ]; then
|
||||
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check kickerrc for 'StorageId[$e]=kde-'.)"
|
||||
Display_Message "$MESSAGE"
|
||||
fi
|
||||
if [ "$R14_UPDATE_TEST1" = "" ] && [ "$R14_UPDATE_TEST2" = "" ] && [ "$R14_UPDATE_TEST3" = "" ] \
|
||||
&& [ "$R14_UPDATE_TEST4" = "" ] && [ "$R14_UPDATE_TEST5" = "" ] && [ "$R14_UPDATE_TEST6" = "" ] \
|
||||
&& [ "$R14_UPDATE_TEST7" = "" ]; then
|
||||
$TDEDIR/bin/kwriteconfig --file kdeglobals --group "R14 XDG Updates" --key Updated --type bool 'true'
|
||||
else
|
||||
$TDEDIR/bin/kwriteconfig --file kdeglobals --group "R14 XDG Updates" --key Updated --type bool 'false'
|
||||
fi
|
||||
fi
|
||||
unset PROFILE_DIR
|
||||
unset R14_UPDATED
|
||||
unset TDEHOME_LINK
|
||||
unset R14_UPDATE_TEST1
|
||||
unset R14_UPDATE_TEST2
|
||||
unset R14_UPDATE_TEST3
|
||||
unset R14_UPDATE_TEST4
|
||||
unset R14_UPDATE_TEST5
|
||||
unset R14_UPDATE_TEST6
|
||||
exit 0
|
Loading…
Reference in new issue