if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
echo -n "[r14-xdg-update] "
if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
printf "%s" "[r14-xdg-update] "
fi
}
@ -60,16 +60,30 @@ 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\``"
# Allow forced execution of this script regardless of the kdeglobals setting
# and allow passing a user home directory as a positional parameter.
if [ "$#" -eq "2" ]; then
if [ "$1" = "force" ] || [ "$2" = "force" ]; then
FORCE="true"
fi
if [ "$1" != "force" ]; then
USER_DIR="$1"
elif [ "$2" != "force" ]; then
USER_DIR="$2"
fi
elif [ "$#" -eq "1" ]; then
if [ "$1" = "force" ]; then
FORCE="true"
else
USER_DIR="$1"
fi
fi
unset KDEGLOBALS_KEY_VALUE
WARNING_MESSAGE="Trinity R14 XDG compliance updates will not be performed automatically.\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\nPlease take appropriate action.\n"
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\nPlease exercise appropriate action.\n"
# As the user should not be logged into a Trinity session when running
# this script, or an administrator might run this script remotely, the
@ -77,29 +91,25 @@ WARNING_MESSAGE="Trinity R14 XDG compliance updates will not be performed automa
# We presume $USER_DIR/.trinity and provide a way to pass an environment
# variable to change that location.
USER_DIR=${USER_DIR:-"$HOME"}
if [ "$USER_DIR" != "$HOME" ] && [ "$UID" != "0" ]; then
echo "root privileges are required to run this script against other user directories. Exiting."
exit 1
fi
if [ "$USER_DIR" != "$HOME" ] && [ "$UID" = "0" ]; then
PROFILE_DIR="$USER_DIR/.trinity"
if [ "$USER_DIR" != "$HOME" ]; then
PROFILE_DIR=${PROFILE_DIR:-"$USER_DIR/.trinity"}
elif [ "$TDEHOME" = "" ]; then
PROFILE_DIR="$USER_DIR/.trinity"
PROFILE_DIR=${PROFILE_DIR:-"$USER_DIR/.trinity"}
else
PROFILE_DIR="$TDEHOME"
fi
if [ ! -d "$PROFILE_DIR" ]; then
MESSAGE="Warning! Unable to find the user profile directory $PROFILE_DIR.\n\n${WARNING_MESSAGE}"
MESSAGE="Warning! Unable to find the user profile directory $PROFILE_DIR.\n\nCheck permissions, paths, and typing.\n\n${WARNING_MESSAGE}"
# Are we in X? Display an X dialog explaining breakage.
if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
# Are we in X? Display an X dialog explaining breakage.
if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
echo "[r14-xdg-update] Warning! The profile directory $PROFILE_DIR is a" 1>&2
echo " sym link to $TDEHOME_LINK!" 1>&2
echo " R14 updates will not be performed because Trinity needs its own" 1>&2
@ -160,9 +183,9 @@ if [ "$TDEHOME_LINK" != "" ]; then
fi
MESSAGE="Oops! The profile directory $PROFILE_DIR is a sym link to $TDEHOME_LINK.\n\n${WARNING_MESSAGE}\nPossible remedies:\n\n* Contact your system administrator.\n\n* Break the sym link to force creating 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 [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
MESSAGE="${MESSAGE}\n\nSelecting the Continue button means retaining the KDE3 profile and\nbreaking the sym link. With the sym link broken, run the migratekde3\nscript before restarting Trinity to migrate a KDE3 profile or\nallow Trinity to create a fresh profile."
@ -179,7 +202,7 @@ if [ "$TDEHOME_LINK" != "" ]; then
fi
else
echo
echo -e "$MESSAGE"
printf "%b" "$MESSAGE"
echo
Wait_For_Response "Break the sym link now?"
Proceed_From_Response
@ -189,14 +212,14 @@ if [ "$TDEHOME_LINK" != "" ]; then
unlink "$USER_DIR/.trinity" 2>/dev/null
if [ "`readlink \"$USER_DIR/.trinity\"`" = "" ]; then
MESSAGE="Sym link broken. With the sym link broken, run the migratekde3\nscript before restarting Trinity to migrate a KDE3 profile or\nallow Trinity to create a fresh profile."
if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
Message_Prefix
fi
echo -e "$MESSAGE"
printf "%b" "$MESSAGE"
echo
else
MESSAGE="Unable to break the sym link. Check file and directory privileges. Quitting."
if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
Message_Prefix
fi
echo "$MESSAGE"
@ -219,8 +242,8 @@ if [ "$R14_UPDATED" != "true" ] || [ "$FORCE" = "true" ]; then
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 [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
# 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 [ "$USER_DIR" = "$HOME" ] && [ "$UID" != "0" ]; then
if [ "$USER_DIR" = "$HOME" ]; then
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.
if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
# As we are in a Trinity session then use kdialog.
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.
if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then