# A script to perform R14.0.0 XDG compliance updates.
# This script should be needed to run only once.
SCRIPT_NAME="`basename \`readlink -f $0\``"
# 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"
CACHE_DIR="$PROFILE_DIR/cache-`uname -n`"
# This script should be needed to run only once, but corner cases
# and file/directory permissions could cause incomplete updates.
# 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.
# 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
TDEDIR=${BIN_DIR%/bin}
else
echo "[r14-xdg-update] Unable to determine TDE base directory."
echo "[r14-xdg-update] This script should be installed in the same directory."
echo "[r14-xdg-update] Exiting."
exit 1
fi
unset BIN_DIR
unset KDEGLOBALS_KEY_VALUE
# administratively or are owned by root and can't be updated.
# The nominal validation checks in this script provide some notice
# but no direct remedy.
Wait_For_Response () {
unset response
@ -91,6 +58,71 @@ else
fi
}
# Main script:
# Allow forced execution of this script regardless of the kdeglobals setting.
if [ "$1" = "force" ]; then
FORCE="true"
fi
SCRIPT_NAME="`basename \`readlink -f $0\``"
unset KDEGLOBALS_KEY_VALUE
WARNING_MESSAGE="Trinity R14 XDG compliance updates will not be performed.\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."
# 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 provide a way to pass an environment
# variable to change that location.
if [ "$TDEHOME" = "" ]; then
PROFILE_DIR=${PROFILE_DIR:-"$HOME/.trinity"}
else
PROFILE_DIR="$TDEHOME"
fi
if [ ! -d "$PROFILE_DIR" ]; then
MESSAGE="Unable to determine the user profile directory.\n\n${WARNING_MESSAGE}"
# Are we in X? Display an X dialog explaining breakage.
# 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.
@ -106,7 +138,7 @@ if [ "$TDEHOME_LINK" != "" ]; then
echo " R14 updates will not be performed because Trinity needs its own separate profile directory." 1>&2
echo " 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."
MESSAGE="Oops! The profile directory $PROFILE_DIR is a sym link to $TDEHOME_LINK.\n\n${WARNING_MESSAGE}\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 [ "$R14_UPDATED" != "true" ] || [ "$FORCE" = "true" ]; then
@ -142,6 +175,7 @@ if [ "$R14_UPDATED" != "true" ] || [ "$FORCE" = "true" ]; then
echo "The r14-xdg-update script has been run at least once."
Message_Prefix
echo "The error code is $R14_UPDATED."
echo
MESSAGE="The r14-xdg-update script has been run at least once.\n\nThe script is not successfully updating.\n\nThe script will run with each login until corrected.\n\nPlease contact an administrator or take appropriate\nadmininstrative action to correct the problem.\n\nThe error code is $R14_UPDATED."
# Are we in X? Display an X dialog explaining breakage.
if [ "$DISPLAY" != "" ]; then
@ -150,68 +184,100 @@ if [ "$R14_UPDATED" != "true" ] || [ "$FORCE" = "true" ]; then
# User select the Quit button: quit this script.
unset PROFILE_DIR
unset R14_UPDATED
unset TDEHOME_LINK
exit 1
fi
fi
fi
Message_Prefix
echo "Performing a profile update for Trinity release R14 XDG compliance."
echo "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
else
echo "This script has been run at least once previously. To run manually pass the 'force' parameter."
exit 0
fi
# Preserve keyboard shortcuts and input actions.
Message_Prefix
echo "Updating user-defined keyboard shortcuts in khotkeysrc."
sed -i 's|CommandURL=kde-|CommandURL=tde-|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
sed -i 's|K Menu - kde-|TDE Menu - tde-|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
sed -i 's|Name=K Menu|Name=TDE Menu|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
sed -i 's|in KDE stands|in TDE stands|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
sed -i 's| use KDE| use TDE|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
Message_Prefix
echo "Updating some text strings in khotkeysrc."
sed -i 's|Go to KDE Website|Go to TDE Website|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
sed -i 's|www\.kde\.org|www\.trinitydesktop\.org|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
sed -i 's|KDE3\.1|TDE|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
sed -i 's|kde32b1|trinity2b1|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
sed -i 's|kde321|trinity21|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
# Fix the some of the same text strings in kglobalshortcutsrc.
# Trap when the user runs this script while in a Trinity session.
# Most files can be updated "live" but some can't, such as kdeglobals.
if [ "$TDE_FULL_SESSION" != "" ] || [ "$TDE_SESSION_UID" != "" ]; then
MESSAGE="You are running this script from within a Trinity session.\n\nMost files can be updated \"live\" but some cannot, such as kdeglobals.\n\nThis script might complete successfully and might not."
# Are we in X? Display an X dialog explaining breakage.
MESSAGE="The r14-xdg-update script did not complete successfully.\n\nThe script will run with each login until corrected.\n\nPlease contact an administrator or take appropriate\nadmininstrative action to correct the problem.\n\nThe error code is $KDEGLOBALS_KEY_VALUE.\n\nBe sure to check file and directory permissions."
# Are we in X? Display an X dialog explaining breakage.