Update r14-xdg-update script to support automated execution and to

allow running against other profiles when run as root.
pull/2/head
Darrell Anderson 12 years ago
parent 0e11879b04
commit 31f926d9ea

@ -36,7 +36,7 @@ fi
} }
Display_Message () { Display_Message () {
if [ "$DISPLAY" != "" ]; then if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
echo -e "$MESSAGE" | xmessage -center -file - > /dev/null 2>/dev/null echo -e "$MESSAGE" | xmessage -center -file - > /dev/null 2>/dev/null
else else
echo -e "$MESSAGE" echo -e "$MESSAGE"
@ -44,7 +44,7 @@ fi
} }
Message_Prefix () { Message_Prefix () {
if [ "$DISPLAY" != "" ]; then if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
echo -n "[r14-xdg-update] " echo -n "[r14-xdg-update] "
fi fi
} }
@ -74,20 +74,27 @@ WARNING_MESSAGE="Trinity R14 XDG compliance updates will not be performed automa
# As the user should not be logged into a Trinity session when running # As the user should not be logged into a Trinity session when running
# this script, or an administrator might run this script remotely, the # this script, or an administrator might run this script remotely, the
# $TDEHOME variable might not be set or knowable from within this script. # $TDEHOME variable might not be set or knowable from within this script.
# We presume $HOME/.trinity and provide a way to pass an environment # We presume $USER_DIR/.trinity and provide a way to pass an environment
# variable to change that location. # variable to change that location.
if [ "$TDEHOME" = "" ]; then USER_DIR=${USER_DIR:-"$HOME"}
PROFILE_DIR=${PROFILE_DIR:-"$HOME/.trinity"} 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"
elif [ "$TDEHOME" = "" ]; then
PROFILE_DIR="$USER_DIR/.trinity"
else else
PROFILE_DIR="$TDEHOME" PROFILE_DIR="$TDEHOME"
fi fi
if [ ! -d "$PROFILE_DIR" ]; then 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\n${WARNING_MESSAGE}"
# Are we in X? Display an X dialog explaining breakage. # Are we in X? Display an X dialog explaining breakage.
if [ "$DISPLAY" != "" ]; then if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
echo -e "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null echo -e "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null
if [ "$?" = "102" ]; then if [ "$?" = "102" ]; then
# User select the Quit button: quit this script. # User selected the Quit button: quit this script.
unset PROFILE_DIR unset PROFILE_DIR
fi fi
else else
@ -106,12 +113,12 @@ BIN_DIR="`dirname \`readlink -f $0\``"
if [ -x $BIN_DIR/tde-config ]; then if [ -x $BIN_DIR/tde-config ]; then
TDEDIR=${BIN_DIR%/bin} TDEDIR=${BIN_DIR%/bin}
else else
MESSAGE="Unable to determine TDE base directory." MESSAGE="Unable to determine the TDE bin directory, where this script should be located."
# Are we in X? Display an X dialog explaining breakage. # Are we in X? Display an X dialog explaining breakage.
if [ "$DISPLAY" != "" ]; then if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
echo -e "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null echo -e "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null
if [ "$?" = "102" ]; then if [ "$?" = "102" ]; then
# User select the Quit button: quit this script. # User selected the Quit button: quit this script.
unset PROFILE_DIR unset PROFILE_DIR
exit 1 exit 1
fi fi
@ -123,6 +130,18 @@ else
fi fi
unset BIN_DIR unset BIN_DIR
Message_Prefix
echo "Performing a profile update for Trinity release R14 XDG compliance."
echo
echo "To run this script as root or automated from within another script,"
echo "set the \$USER_DIR environment variable before running the script."
echo "For example: USER_DIR=/home/user_name r14-xdg-update"
echo
Message_Prefix
echo "User directory: $USER_DIR"
echo "Profile directory: $PROFILE_DIR"
echo
# Do not update when $TDEHOME is a sym link to another profile directory. Trinity should have # 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 # full reign within its own profile directory (limited to administrative locking), but the error
# check is a conservative approach. # check is a conservative approach.
@ -130,9 +149,9 @@ TDEHOME_LINK="`readlink \"$PROFILE_DIR\"`"
if [ "$TDEHOME_LINK" != "" ]; then if [ "$TDEHOME_LINK" != "" ]; then
# Force this entry to ensure the updates eventually are performed should the user copy the # Force this entry to ensure the updates eventually are performed should the user copy the
# original kdeglobals file into a new Trinity profile. # original kdeglobals file into a new Trinity profile.
# $TDEDIR/bin/kwriteconfig --file kdeglobals --group "R14 XDG Updates" --key Updated --type bool 'false' # $TDEDIR/bin/kwriteconfig --file "$PROFILE_DIR/share/config/kdeglobals" --group "R14 XDG Updates" --key Updated --type bool 'false'
# Are we in X? Display an X dialog explaining breakage. # Are we in X? Display an X dialog explaining breakage.
if [ "$DISPLAY" != "" ]; then if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
echo "[r14-xdg-update] Warning! The profile directory $PROFILE_DIR is a" 1>&2 echo "[r14-xdg-update] Warning! The profile directory $PROFILE_DIR is a" 1>&2
echo " sym link to $TDEHOME_LINK!" 1>&2 echo " sym link to $TDEHOME_LINK!" 1>&2
echo " R14 updates will not be performed because Trinity needs its own" 1>&2 echo " R14 updates will not be performed because Trinity needs its own" 1>&2
@ -141,7 +160,7 @@ if [ "$TDEHOME_LINK" != "" ]; then
fi 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." 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. # Are we in X? Display an X dialog explaining breakage.
if [ "$DISPLAY" != "" ]; then if [ "$UID" != "0" ] && [ "$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." 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."
echo -e "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null echo -e "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null
EXIT_CODE="$?" EXIT_CODE="$?"
@ -167,17 +186,17 @@ if [ "$TDEHOME_LINK" != "" ]; then
BREAK_SYMLINK="true" BREAK_SYMLINK="true"
fi fi
if [ "$BREAK_SYMLINK" = "true" ]; then if [ "$BREAK_SYMLINK" = "true" ]; then
unlink "$HOME/.trinity" 2>/dev/null unlink "$USER_DIR/.trinity" 2>/dev/null
if [ "`readlink \"$HOME/.trinity\"`" = "" ]; then 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." 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 [ "$DISPLAY" != "" ]; then if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
Message_Prefix Message_Prefix
fi fi
echo -e "$MESSAGE" echo -e "$MESSAGE"
echo echo
else else
MESSAGE="Unable to break the sym link. Check file and directory privileges. Quitting." MESSAGE="Unable to break the sym link. Check file and directory privileges. Quitting."
if [ "$DISPLAY" != "" ]; then if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
Message_Prefix Message_Prefix
fi fi
echo "$MESSAGE" echo "$MESSAGE"
@ -190,7 +209,7 @@ if [ "$TDEHOME_LINK" != "" ]; then
fi fi
unset TDEHOME_LINK unset TDEHOME_LINK
R14_UPDATED="`$TDEDIR/bin/kreadconfig --file kdeglobals --group "R14 XDG Updates" --key Updated`" R14_UPDATED="`$TDEDIR/bin/kreadconfig --file "$PROFILE_DIR/share/config/kdeglobals" --group "R14 XDG Updates" --key Updated`"
if [ "$R14_UPDATED" != "true" ] || [ "$FORCE" = "true" ]; then if [ "$R14_UPDATED" != "true" ] || [ "$FORCE" = "true" ]; then
if [ "$R14_UPDATED" != "true" ] && [ "$R14_UPDATED" != "false" ] && [ "$R14_UPDATED" != "" ]; then if [ "$R14_UPDATED" != "true" ] && [ "$R14_UPDATED" != "false" ] && [ "$R14_UPDATED" != "" ]; then
Message_Prefix Message_Prefix
@ -200,7 +219,7 @@ if [ "$R14_UPDATED" != "true" ] || [ "$FORCE" = "true" ]; then
echo 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." 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. # Are we in X? Display an X dialog explaining breakage.
if [ "$DISPLAY" != "" ]; then if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
echo -e "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null echo -e "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null
if [ "$?" = "102" ]; then if [ "$?" = "102" ]; then
# User select the Quit button: quit this script. # User select the Quit button: quit this script.
@ -217,10 +236,11 @@ fi
# Trap when the user runs this script while in a Trinity session. # 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. # Most files can be updated "live" but some can't, such as kdeglobals.
if [ "$USER_DIR" = "$HOME" ] && [ "$UID" != "0" ]; then
if [ "$TDE_FULL_SESSION" != "" ] || [ "$TDE_SESSION_UID" != "" ]; 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." 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. # Are we in X? Display an X dialog explaining breakage.
if [ "$DISPLAY" != "" ]; then if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
# As we are in a Trinity session then use kdialog. # As we are in a Trinity session then use kdialog.
kdialog --title "R14-XDG-Update" --warningyesno "${MESSAGE}\n\nContinue?" kdialog --title "R14-XDG-Update" --warningyesno "${MESSAGE}\n\nContinue?"
if [ "$?" -gt "0" ]; then if [ "$?" -gt "0" ]; then
@ -234,17 +254,14 @@ if [ "$TDE_FULL_SESSION" != "" ] || [ "$TDE_SESSION_UID" != "" ]; then
Proceed_From_Response Proceed_From_Response
fi fi
fi fi
fi
Message_Prefix
echo "Performing a profile update for Trinity release R14 XDG compliance."
Message_Prefix
echo "Profile directory: $PROFILE_DIR"
Message_Prefix Message_Prefix
echo "Updating *.desktop files." echo "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|X-KDE-|X-TDE-|g' {} \; 2>/dev/null
find "$PROFILE_DIR" -name "*.desktop" -exec sed -i 's|KDE\;|TDE\;|g' {} \; 2>/dev/null find "$PROFILE_DIR" -name "*.desktop" -exec sed -i 's|KDE\;|TDE\;|g' {} \; 2>/dev/null
find "$HOME/.local" -name "*.desktop" -exec sed -i 's|X-KDE-|X-TDE-|g' {} \; 2>/dev/null find "$USER_DIR/.local" -name "*.desktop" -exec sed -i 's|X-KDE-|X-TDE-|g' {} \; 2>/dev/null
find "$HOME/.local" -name "*.desktop" -exec sed -i 's|KDE\;|TDE\;|g' {} \; 2>/dev/null find "$USER_DIR/.local" -name "*.desktop" -exec sed -i 's|KDE\;|TDE\;|g' {} \; 2>/dev/null
Message_Prefix Message_Prefix
echo "Updating references of $TDEDIR/share/applications/kde to share/applications/tde." echo "Updating references of $TDEDIR/share/applications/kde to share/applications/tde."
# Exclude KMail mail files --- we don't want to touch those files. # Exclude KMail mail files --- we don't want to touch those files.
@ -305,7 +322,7 @@ else
echo "Quick Launch is not installed." echo "Quick Launch is not installed."
fi fi
# Update sym link files in $HOME/.trinity/Autostart. # Update sym link files in $USER_DIR/.trinity/Autostart.
if [ -d "$PROFILE_DIR/Autostart" ]; then if [ -d "$PROFILE_DIR/Autostart" ]; then
( cd "$PROFILE_DIR/Autostart" ( cd "$PROFILE_DIR/Autostart"
Message_Prefix Message_Prefix
@ -332,8 +349,8 @@ else
fi fi
# Update the user's customized menu. # Update the user's customized menu.
if [ -r $HOME/.config/menus/applications-kmenuedit.menu ]; then if [ -r $USER_DIR/.config/menus/applications-kmenuedit.menu ]; then
sed -i 's|<Filename>kde-|<Filename>tde-|g' $HOME/.config/menus/applications-kmenuedit.menu sed -i 's|<Filename>kde-|<Filename>tde-|g' $USER_DIR/.config/menus/applications-kmenuedit.menu
fi fi
# Perform some nominal update validations. # Perform some nominal update validations.
@ -347,74 +364,93 @@ else
fi fi
# This first test includes *.desktop files in the profile Autostart directory. # This first test includes *.desktop files in the profile Autostart directory.
TEST_NUM="1" TEST_NUM="1"
R14_UPDATE_TEST1="`find \"$PROFILE_DIR\" -name \"*.desktop\" -exec grep -q \"X-KDE\" {} \; &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt`" R14_UPDATE_TEST1=""
if [ "$R14_UPDATE_TEST1" != "" ]; then find "$PROFILE_DIR" -name "*.desktop" -exec grep -l "X-KDE" {} \; &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt
if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt ]; then
R14_UPDATE_TEST1="failed"
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check *.desktop files for 'X-KDE' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)" MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check *.desktop files for 'X-KDE' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)"
Validation_Failure Validation_Failure
else else
rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null
fi fi
TEST_NUM="2" TEST_NUM="2"
R14_UPDATE_TEST2="`find \"$PROFILE_DIR\" -name \"*.desktop\" -exec grep -q \"KDE;\" {} \; &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt`" R14_UPDATE_TEST2=""
if [ "$R14_UPDATE_TEST2" != "" ]; then find $PROFILE_DIR -name "*.desktop" -exec grep -l "KDE;" {} \; &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt
if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt ]; then
R14_UPDATE_TEST2="failed"
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check *.desktop files for 'KDE;' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)" MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check *.desktop files for 'KDE;' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)"
Validation_Failure Validation_Failure
else else
rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null
fi fi
TEST_NUM="3" TEST_NUM="3"
R14_UPDATE_TEST3="`find \"$PROFILE_DIR\" \"$PROFILE_DIR/share/apps/kmail/mail\" -prune -o -type f -exec grep -q \"$TDEDIR/share/applications/kde\" {} \; &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt`" R14_UPDATE_TEST3=""
if [ "$R14_UPDATE_TEST3" != "" ]; then find "$PROFILE_DIR" "$PROFILE_DIR/share/apps/kmail/mail" -prune -o -type f -exec grep -l "$TDEDIR/share/applications/kde" {} \; &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt
if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt ]; then
R14_UPDATE_TEST3="failed"
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check files for '$TDEDIR/share/applications/kde' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)" MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check files for '$TDEDIR/share/applications/kde' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)"
Validation_Failure Validation_Failure
else else
rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null
fi fi
TEST_NUM="4" TEST_NUM="4"
R14_UPDATE_TEST4="`grep -q \"CommandURL=kde-\" \"$PROFILE_DIR/share/config/khotkeysrc\" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt`" R14_UPDATE_TEST4=""
if [ "$R14_UPDATE_TEST4" != "" ]; then grep "CommandURL=kde-" "$PROFILE_DIR/share/config/khotkeysrc" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt
if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt ]; then
R14_UPDATE_TEST4="failed"
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check khotkeysrc for 'CommandURL=kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)" MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check khotkeysrc for 'CommandURL=kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)"
else else
rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null
fi fi
TEST_NUM="5" TEST_NUM="5"
R14_UPDATE_TEST5="`grep -q \"K Menu - kde-\" \"$PROFILE_DIR/share/config/khotkeysrc\" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt`" R14_UPDATE_TEST5=""
if [ "$R14_UPDATE_TEST5" != "" ]; then grep "K Menu - kde-" "$PROFILE_DIR/share/config/khotkeysrc" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt
if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt ]; then
R14_UPDATE_TEST5="failed"
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check khotkeysrc for 'K Menu - kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)" MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check khotkeysrc for 'K Menu - kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)"
Validation_Failure Validation_Failure
else else
rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null
fi fi
TEST_NUM="6" TEST_NUM="6"
R14_UPDATE_TEST6="`grep -q \"Application=kde-\" \"$PROFILE_DIR/share/config/profilerc\" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt`" R14_UPDATE_TEST6=""
if [ "$R14_UPDATE_TEST6" != "" ]; then grep "Application=kde-" "$PROFILE_DIR/share/config/profilerc" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt
if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt ]; then
R14_UPDATE_TEST6="failed"
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check profilerc for 'Application=kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)" MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check profilerc for 'Application=kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)"
Validation_Failure Validation_Failure
else else
rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null
fi fi
TEST_NUM="7" TEST_NUM="7"
R14_UPDATE_TEST7="`grep -q \"StorageId\[\$e\]=kde-\" \"$PROFILE_DIR/share/config/kickerrc\" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt`" R14_UPDATE_TEST7=""
if [ "$R14_UPDATE_TEST7" != "" ]; then grep "StorageId\[\$e\]=kde-" "$PROFILE_DIR/share/config/kickerrc" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt
if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt ]; then
R14_UPDATE_TEST7="failed"
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check kickerrc for 'StorageId[$e]=kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)" MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check kickerrc for 'StorageId[$e]=kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)"
Validation_Failure Validation_Failure
else else
rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null
fi fi
if [ "$QUICK_LAUNCH_CONFIG" != "" ]; then
TEST_NUM="8" TEST_NUM="8"
R14_UPDATE_TEST8="`grep -q \"kde-\" \"$PROFILE_DIR/share/config/$QUICK_LAUNCH_CONFIG\" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt`" R14_UPDATE_TEST8=""
if [ "$R14_UPDATE_TEST8" != "" ]; then if [ "$QUICK_LAUNCH_CONFIG" != "" ]; then
grep "kde-" "$PROFILE_DIR/share/config/$QUICK_LAUNCH_CONFIG" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt
if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt ]; then
R14_UPDATE_TEST8="failed"
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check $QUICK_LAUNCH_CONFIG for 'kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)" MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check $QUICK_LAUNCH_CONFIG for 'kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)"
Validation_Failure Validation_Failure
else else
rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null rm -f ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt 2>/dev/null
fi fi
fi fi
if [ -r $HOME/.config/menus/applications-kmenuedit.menu ]; then
TEST_NUM="9" TEST_NUM="9"
R14_UPDATE_TEST9="`grep -q \"<Filename>kde-\" \"$HOME/.config/menus/applications-kmenuedit.menu\" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt`" R14_UPDATE_TEST9=""
if [ "$R14_UPDATE_TEST9" != "" ]; then if [ -r $USER_DIR/.config/menus/applications-kmenuedit.menu ]; then
grep "<Filename>kde-" "$USER_DIR/.config/menus/applications-kmenuedit.menu" &>${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt
if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt ]; then
R14_UPDATE_TEST9="failed"
MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check applications-kmenuedit.menu for '<Filename>kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)" MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\n\n(Check applications-kmenuedit.menu for '<Filename>kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-test${TEST_NUM}.txt.)"
Validation_Failure Validation_Failure
else else
@ -424,15 +460,15 @@ fi
if [ "$R14_UPDATE_TEST1" = "" ] && [ "$R14_UPDATE_TEST2" = "" ] && [ "$R14_UPDATE_TEST3" = "" ] \ if [ "$R14_UPDATE_TEST1" = "" ] && [ "$R14_UPDATE_TEST2" = "" ] && [ "$R14_UPDATE_TEST3" = "" ] \
&& [ "$R14_UPDATE_TEST4" = "" ] && [ "$R14_UPDATE_TEST5" = "" ] && [ "$R14_UPDATE_TEST6" = "" ] \ && [ "$R14_UPDATE_TEST4" = "" ] && [ "$R14_UPDATE_TEST5" = "" ] && [ "$R14_UPDATE_TEST6" = "" ] \
&& [ "$R14_UPDATE_TEST7" = "" ] && [ "$R14_UPDATE_TEST8" = "" ] && [ "$R14_UPDATE_TEST9" = "" ]; then && [ "$R14_UPDATE_TEST7" = "" ] && [ "$R14_UPDATE_TEST8" = "" ] && [ "$R14_UPDATE_TEST9" = "" ]; then
$TDEDIR/bin/kwriteconfig --file kdeglobals --group "R14 XDG Updates" --key Updated --type bool "true" $TDEDIR/bin/kwriteconfig --file "$PROFILE_DIR/share/config/kdeglobals" --group "R14 XDG Updates" --key Updated --type bool "true"
Message_Prefix Message_Prefix
echo "R14 XDG updates completed successfully." echo "R14 XDG updates completed successfully."
else else
# Don't use the --type parameter here because the value no longer is boolean. # Don't use the --type parameter here because the value no longer is boolean.
$TDEDIR/bin/kwriteconfig --file kdeglobals --group "R14 XDG Updates" --key Updated "$KDEGLOBALS_KEY_VALUE" $TDEDIR/bin/kwriteconfig --file "$PROFILE_DIR/share/config/kdeglobals" --group "R14 XDG Updates" --key Updated "$KDEGLOBALS_KEY_VALUE"
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." 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. # Are we in X? Display an X dialog explaining breakage.
if [ "$DISPLAY" != "" ]; then if [ "$UID" != "0" ] && [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
echo -e "$MESSAGE" | xmessage -center -file - -buttons OK > /dev/null 2>/dev/null echo -e "$MESSAGE" | xmessage -center -file - -buttons OK > /dev/null 2>/dev/null
else else
Message_Prefix Message_Prefix
@ -440,6 +476,7 @@ else
fi fi
fi fi
unset USER_DIR
unset PROFILE_DIR unset PROFILE_DIR
unset R14_UPDATED unset R14_UPDATED
unset R14_UPDATE_TEST1 unset R14_UPDATE_TEST1

Loading…
Cancel
Save