TDE base libraries and programs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1192 line
56 KiB

  1. #!/bin/sh
  2. #
  3. # A script to perform R14.0.0 XDG compliance updates.
  4. SCRIPT_NAME="$(basename -- "$0")"
  5. SCRIPT_VERSION=202004080
  6. # This script should be needed to run only once, but corner cases
  7. # and file/directory permissions could cause incomplete updates.
  8. # TODO: How to handle environments where files/directories are locked
  9. # administratively or are owned by root and can't be updated.
  10. # The nominal validation checks in this script provide some notice
  11. # but no direct remedy.
  12. # TODO: How to update profile directories not named $HOME/.trinity and $TDEHOME
  13. # is not yet declared when running this script.
  14. Wait_For_Response () {
  15. unset response
  16. while true; do
  17. printf "%s" "$1 (y/n): " > /dev/tty
  18. IFS= read -r ANSWER < /dev/tty || exit 1;
  19. case $ANSWER in
  20. y* | Y* ) response=y; break;;
  21. n* | N* ) response=n; break;;
  22. * ) echo "Please answer yes (y/Y) or no (n/N)." > /dev/tty;;
  23. esac
  24. done
  25. unset ANSWER
  26. }
  27. Proceed_From_Response () {
  28. if [ "$response" = "n" ]; then
  29. echo "Exiting."
  30. echo
  31. exit 0
  32. else
  33. unset response
  34. echo "Continuing."
  35. echo
  36. fi
  37. }
  38. Message_Prefix () {
  39. if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
  40. printf "%s" "[r14-xdg-update] "
  41. fi
  42. }
  43. Validation_Failure () {
  44. if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
  45. printf "%b" "$MESSAGE" | xmessage -center -file - > /dev/null 2>/dev/null
  46. else
  47. printf "%b" "$MESSAGE"
  48. fi
  49. if [ "$KDEGLOBALS_KEY_VALUE" = "" ]; then
  50. KDEGLOBALS_KEY_VALUE="$TEST_NUM"
  51. else
  52. KDEGLOBALS_KEY_VALUE="$KDEGLOBALS_KEY_VALUE;$TEST_NUM"
  53. fi
  54. }
  55. Log () {
  56. echo "$@" | \
  57. while read l; do
  58. Message_Prefix
  59. echo "$l"
  60. done
  61. }
  62. # Main script:
  63. # Allow forced execution of this script regardless of the kdeglobals setting
  64. # and allow passing a user home directory as a positional parameter.
  65. if [ "$#" -eq "2" ]; then
  66. if [ "$1" = "force" ] || [ "$2" = "force" ]; then
  67. FORCE="true"
  68. fi
  69. if [ "$1" != "force" ]; then
  70. USER_DIR="$1"
  71. elif [ "$2" != "force" ]; then
  72. USER_DIR="$2"
  73. fi
  74. elif [ "$#" -eq "1" ]; then
  75. if [ "$1" = "force" ]; then
  76. FORCE="true"
  77. else
  78. USER_DIR="$1"
  79. fi
  80. fi
  81. unset KDEGLOBALS_KEY_VALUE
  82. WARNING_MESSAGE="Trinity R14 XDG compliance updates have been interrupted.\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"
  83. # As the user should not be logged into a Trinity session when running
  84. # this script, or an administrator might run this script remotely, the
  85. # $TDEHOME variable might not be set or knowable from within this script.
  86. # We presume $USER_DIR/.trinity and provide a way to pass an environment
  87. # variable to change that location.
  88. USER_DIR=${USER_DIR:-"$HOME"}
  89. if [ "$USER_DIR" != "$HOME" ]; then
  90. PROFILE_DIR=${PROFILE_DIR:-"$USER_DIR/.trinity"}
  91. elif [ "$TDEHOME" = "" ]; then
  92. PROFILE_DIR=${PROFILE_DIR:-"$USER_DIR/.trinity"}
  93. else
  94. PROFILE_DIR="$TDEHOME"
  95. fi
  96. if [ ! -d "$PROFILE_DIR" ]; then
  97. MESSAGE="Warning! Unable to find the user profile directory $PROFILE_DIR.\n\nCheck permissions, paths, and typing.\n\n${WARNING_MESSAGE}"
  98. # Are we in X? Display an X dialog explaining breakage.
  99. if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
  100. printf "%b" "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null
  101. if [ "$?" = "102" ]; then
  102. # User selected the Quit button: quit this script.
  103. unset PROFILE_DIR
  104. fi
  105. else
  106. Message_Prefix
  107. printf "%b" "$MESSAGE"
  108. fi
  109. exit 1
  110. fi
  111. # The binaries for TDE are located in the same place as this script.
  112. # To determine that location use the following method rather than presuming
  113. # the existence of $TDEDIR. That environment variable might not be
  114. # defined or defined to point to KDE4 binaries.
  115. BIN_DIR="$(dirname -- "$0")"
  116. if [ -x $BIN_DIR/tde-config ]; then
  117. TDEDIR="${BIN_DIR%/bin}"
  118. else
  119. MESSAGE="Unable to determine the TDE bin directory, where this script should be installed."
  120. # Are we in X? Display an X dialog explaining breakage.
  121. if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
  122. printf "%b" "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null
  123. if [ "$?" = "102" ]; then
  124. # User selected the Quit button: quit this script.
  125. unset PROFILE_DIR
  126. exit 1
  127. fi
  128. else
  129. Message_Prefix
  130. printf "%b" "$MESSAGE\n\n${WARNING_MESSAGE}"
  131. fi
  132. exit 1
  133. fi
  134. unset BIN_DIR
  135. Log "Performing a profile update for Trinity release R14 XDG compliance."
  136. Log ""
  137. Log "To run this script against a different user directory, or automated"
  138. Log "from within another script, pass the directory path as a parameter."
  139. Log "For example: r14-xdg-update /home/user_dir"
  140. Log "Use the user home directory and not the profile directory."
  141. Log "User directory: $USER_DIR"
  142. Log "Profile directory: $PROFILE_DIR"
  143. Log ""
  144. if [ "$USER_DIR" != "$HOME" ]; then
  145. Log "Root (admin) privileges might be required to run this script"
  146. Log "against other user directories."
  147. Log "This script is being run against $USER_DIR."
  148. Log "Your normal user directory is $HOME."
  149. fi
  150. # Do not update when $TDEHOME is a sym link to another profile directory. Trinity should have
  151. # full reign within its own profile directory (limited to administrative locking), but the error
  152. # check is a conservative approach.
  153. TDEHOME_LINK="`readlink \"$PROFILE_DIR\"`"
  154. if [ "$TDEHOME_LINK" != "" ]; then
  155. # Force this entry to ensure the updates eventually are performed should the user copy the
  156. # original kdeglobals file into a new Trinity profile.
  157. # $TDEDIR/bin/kwriteconfig --file "$PROFILE_DIR/share/config/kdeglobals" --group "R14 XDG Updates" --key Updated --type bool 'false'
  158. # Are we in X? Display an X dialog explaining breakage.
  159. if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
  160. echo "[r14-xdg-update] Warning! The profile directory $PROFILE_DIR is a" 1>&2
  161. echo " sym link to $TDEHOME_LINK!" 1>&2
  162. echo " R14 updates will not continue because Trinity needs its own" 1>&2
  163. echo " separate profile directory." 1>&2
  164. echo " Without R14 updates some Trinity apps will fail to function correctly." 1>&2
  165. fi
  166. 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* Manually break the sym link to force creating a fresh Trinity profile.\n\n* Use the ${TDEDIR}/bin/migratekde3 script to migrate a KDE3 profile to Trinity."
  167. # Are we in X? Display an X dialog explaining breakage.
  168. if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
  169. MESSAGE="${MESSAGE}\n\nSelecting the Continue button means preserving the KDE3 profile and\nbreaking the sym link. With the sym link broken, the ${TDEDIR}/bin/migratekde3\nscript will run to migrate the KDE3 profile to Trinity."
  170. printf "%b" "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null
  171. EXIT_CODE="$?"
  172. unset TDEHOME_LINK
  173. if [ "$EXIT_CODE" = "102" ]; then
  174. # User selected the Quit button: quit this script and exit X.
  175. unset PROFILE_DIR
  176. Log "The user chose to quit."
  177. exit 1
  178. else
  179. # User selected the Continue button: continue this script and start TDE.
  180. Log "The user chose to continue to break the sym link."
  181. BREAK_SYMLINK="true"
  182. fi
  183. else
  184. echo
  185. printf "%b" "$MESSAGE"
  186. echo
  187. Wait_For_Response "Break the sym link now?"
  188. Proceed_From_Response
  189. BREAK_SYMLINK="true"
  190. fi
  191. if [ "$BREAK_SYMLINK" = "true" ]; then
  192. unlink "$USER_DIR/.trinity" 2>/dev/null
  193. if [ "`readlink \"$USER_DIR/.trinity\"`" = "" ]; then
  194. MESSAGE="Sym link broken. With the sym link broken, will now attempt\nto migrate the KDE3 profile."
  195. Message_Prefix
  196. printf "%b" "$MESSAGE"
  197. echo
  198. ${TDEDIR}/bin/migratekde3
  199. else
  200. MESSAGE="Unable to break the sym link. Check file and directory privileges. Quitting."
  201. Message_Prefix
  202. echo "$MESSAGE"
  203. echo
  204. unset PROFILE_DIR
  205. unset TDEHOME_LINK
  206. exit 1
  207. fi
  208. fi
  209. fi
  210. unset TDEHOME_LINK
  211. R14_UPDATED="`$TDEDIR/bin/kreadconfig --file "$PROFILE_DIR/share/config/kdeglobals" --group "R14 XDG Updates" --key Updated`"
  212. R14_VERSION="`$TDEDIR/bin/kreadconfig --file "$PROFILE_DIR/share/config/kdeglobals" --group "R14 XDG Updates" --key Version --default 0`"
  213. if [ "$R14_VERSION" -lt "$SCRIPT_VERSION" ] || [ "$R14_UPDATED" != "true" ] || [ "$FORCE" = "true" ]; then
  214. if [ "$R14_UPDATED" != "true" ] && [ "$R14_UPDATED" != "false" ] && [ "$R14_UPDATED" != "" ]; then
  215. Log "The r14-xdg-update script has been run at least once."
  216. Log "The error code is $R14_UPDATED."
  217. echo
  218. if [ "$FORCE" != "true" ]; then
  219. # There is an error code.
  220. # As a previous attempt failed, try again to perform a full update.
  221. FORCE="true"
  222. fi
  223. MESSAGE="The r14-xdg-update script will attempt to repair the problems found during the previous\nsession and will run with each login until all issues are corrected\n(usually one time is enough).\n\nPlease contact an administrator or take appropriate admininstrative\naction should the problems persist for more than three reboot attempts.\n\nThe error code is $R14_UPDATED."
  224. # Are we in X? Display an X dialog explaining breakage.
  225. if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
  226. printf "%b" "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null
  227. if [ "$?" = "102" ]; then
  228. # User select the Quit button: quit this script.
  229. unset PROFILE_DIR
  230. unset R14_UPDATED
  231. exit 1
  232. fi
  233. fi
  234. fi
  235. else
  236. echo "This script has been run at least once previously. To run manually pass the 'force' parameter."
  237. exit 0
  238. fi
  239. if [ "$FORCE" = "true" ]; then
  240. R14_VERSION=0
  241. fi
  242. # Trap when the user runs this script while in a Trinity session.
  243. # Most files can be updated "live" but some can't, such as kdeglobals.
  244. if [ "$USER_DIR" = "$HOME" ]; then
  245. if [ "$TDE_FULL_SESSION" != "" ] || [ "$TDE_SESSION_UID" != "" ]; then
  246. MESSAGE="You are running this script from while a Trinity session is active.\n\nMost files can be updated \"live\" but some cannot, such as kdeglobals.\n\nThis script might complete successfully and might not."
  247. Message_Prefix
  248. printf "%b" "$MESSAGE\n\n${WARNING_MESSAGE}"
  249. Wait_For_Response "Continue?"
  250. Proceed_From_Response
  251. fi
  252. fi
  253. # Get directories for temporary files
  254. # All three directories are for temporary files. The cache directory is
  255. # intended for persistent temporary data (is expected to remain across reboots
  256. # and shutdowns). The other two directories are for non-persistent data and
  257. # can be deleted across reboots and shutdowns.
  258. CACHE_DIR="`readlink $PROFILE_DIR/cache-\`uname -n\``"
  259. SOCKET_DIR="`readlink $PROFILE_DIR/socket-\`uname -n\``"
  260. TMP_DIR="`readlink $PROFILE_DIR/tmp-\`uname -n\``"
  261. if [ "$R14_VERSION" -lt "201309150" ]; then
  262. Log "Updating temp file locations."
  263. # Delete the non-persistent temporary directories. This is safe at any time.
  264. unlink $PROFILE_DIR/socket-`uname -n` 2>/dev/null
  265. unlink $PROFILE_DIR/tmp-`uname -n` 2>/dev/null
  266. if [ "$SOCKET_DIR" != "" ]; then
  267. rm -fr $SOCKET_DIR 2>/dev/null
  268. fi
  269. if [ "$TMP_DIR" != "" ]; then
  270. rm -fr $TMP_DIR 2>/dev/null
  271. fi
  272. # Remember that this script may be run more than once. The new directory
  273. # might already exist.
  274. if [ "$CACHE_DIR" != "" ] && [ -d "$CACHE_DIR" ]; then
  275. # Flush the obsolete ksycoca cache files.
  276. rm -f ${CACHE_DIR}/ksycoca* 2>/dev/null
  277. # Flush the tdesycoca cache files. This is safe at any time.
  278. rm -f ${CACHE_DIR}/tdesycoca* 2>/dev/null
  279. # Old cache directory: /var/tmp/kde*cache-$USER
  280. # New cache directory: /var/tmp/tdecache-$USER
  281. # Rename/move the directory name but only when the new name does not exist.
  282. if [ "`echo $CACHEDIR | grep tdecache`" = "" ]; then
  283. Log "Renaming the temporary cache directory."
  284. unlink $PROFILE_DIR/cache-`uname -n` 2>/dev/null
  285. mv -f $CACHE_DIR `dirname $CACHE_DIR`/tdecache-$USER 2>/dev/null
  286. Log "Creating a sym link for the temporary cache directory."
  287. ln -s `dirname $CACHE_DIR`/tdecache-$USER $PROFILE_DIR/cache-`uname -n`
  288. fi
  289. fi
  290. # Housekeeping: the old locations are no longer needed.
  291. if [ "$CACHE_DIR" != "" ]; then
  292. rm -fr `dirname 2>/dev/null $CACHE_DIR`/kde*cache-$USER
  293. fi
  294. if [ "$SOCKET_DIR" != "" ]; then
  295. rm -fr `dirname 2>/dev/null $SOCKET_DIR`/ksocket-$USER
  296. fi
  297. if [ "$TMP_DIR" != "" ]; then
  298. rm -fr `dirname 2>/dev/null $TMP_DIR`/kde-$USER
  299. fi
  300. fi
  301. if [ "$R14_VERSION" -lt "201412080" ]; then
  302. Log "Updating references of temporary paths."
  303. # Get base for temporary directories
  304. if [ "$CACHE_DIR" = "" ]; then
  305. CACHE_BASE_DIR=/var/tmp
  306. else
  307. CACHE_BASE_DIR=`dirname $CACHE_DIR`
  308. fi
  309. if [ "$SOCKET_DIR" = "" ]; then
  310. SOCKET_BASE_DIR=/tmp
  311. else
  312. SOCKET_BASE_DIR=`dirname $SOCKET_DIR`
  313. fi
  314. if [ "$TMP_DIR" = "" ]; then
  315. TMP_BASE_DIR=/tmp
  316. else
  317. TMP_BASE_DIR=`dirname $TMP_DIR`
  318. fi
  319. # Exclude user data files --- we don't want to touch those files.
  320. find "$PROFILE_DIR" \
  321. -path $PROFILE_DIR/share/apps/amarok/albumcovers -prune -o \
  322. -path $PROFILE_DIR/share/apps/basket/baskets -prune -o \
  323. -path $PROFILE_DIR/share/apps/juk/covers -prune -o \
  324. -path $PROFILE_DIR/share/apps/kget/logs -prune -o \
  325. -path $PROFILE_DIR/share/apps/kmail/autosave -prune -o \
  326. -path $PROFILE_DIR/share/apps/kmail/dimap -prune -o \
  327. -path $PROFILE_DIR/share/apps/kmail/imap -prune -o \
  328. -path $PROFILE_DIR/share/apps/kmail/mail -prune -o \
  329. -path $PROFILE_DIR/share/apps/kmail/search -prune -o \
  330. -path $PROFILE_DIR/share/apps/knotes -prune -o \
  331. -path $PROFILE_DIR/share/apps/kopete/logs -prune -o \
  332. -type f -print0 2>/dev/null | \
  333. xargs -r0 grep -ZIEl "($TMP_BASE_DIR/kde|$SOCKET_BASE_DIR/ksocket|$CACHE_BASE_DIR/kde[0-9]*cache)-" | \
  334. xargs -r0 sed -ri -e "s|$TMP_BASE_DIR/kde-|$TMP_BASDE_DIR/tde-|g" \
  335. -e "s|$SOCKET_BASE_DIR/ksocket-|$SOCKET_BASE_DIR/tdesocket-|g" \
  336. -e "s|$CACHE_BASE_DIR/kde[0-9]*cache-|$CACHE_BASE_DIR/tdecache-|g"
  337. # Cleanup variables
  338. unset CACHE_BASE_DIR
  339. unset SOCKET_BASE_DIR
  340. unset TMP_BASE_DIR
  341. fi
  342. if [ "$R14_VERSION" -lt "201309150" ]; then
  343. Log "Updating references of $TDEDIR/share/applications/kde to share/applications/tde."
  344. # Exclude KMail mail files --- we don't want to touch those files.
  345. find "$PROFILE_DIR" \
  346. -path $PROFILE_DIR/share/apps/amarok/albumcovers -prune -o \
  347. -path $PROFILE_DIR/share/apps/basket/baskets -prune -o \
  348. -path $PROFILE_DIR/share/apps/juk/covers -prune -o \
  349. -path $PROFILE_DIR/share/apps/kget/logs -prune -o \
  350. -path $PROFILE_DIR/share/apps/kmail/autosave -prune -o \
  351. -path $PROFILE_DIR/share/apps/kmail/dimap -prune -o \
  352. -path $PROFILE_DIR/share/apps/kmail/imap -prune -o \
  353. -path $PROFILE_DIR/share/apps/kmail/mail -prune -o \
  354. -path $PROFILE_DIR/share/apps/kmail/search -prune -o \
  355. -path $PROFILE_DIR/share/apps/knotes -prune -o \
  356. -path $PROFILE_DIR/share/apps/kopete/logs -prune -o \
  357. -type f -print0 2>/dev/null | \
  358. xargs -r0 grep -ZIFl "$TDEDIR/share/applications/kde" | \
  359. xargs -r0 sed -i "s|$TDEDIR/share/applications/kde|$TDEDIR/share/applications/tde|g"
  360. fi
  361. if [ "$R14_VERSION" -lt "201312160" ]; then
  362. Log "Updating references of kconf to tdeconf."
  363. find "$PROFILE_DIR"/share/config -type f -print0 2>/dev/null | \
  364. xargs -r0 grep -ZIEl "([^a-zA-Z0-9]|^)kconf" | \
  365. xargs -r0 sed -ri "s|([^a-zA-Z0-9]\|^)kconf|\1tdeconf|g"
  366. fi
  367. # Preserve keyboard shortcuts and input actions.
  368. if [ "$R14_VERSION" -lt "201309150" ]; then
  369. if [ -r "$PROFILE_DIR/share/config/khotkeysrc" ]; then
  370. Log "Updating user-defined keyboard shortcuts in khotkeysrc."
  371. sed -i 's|CommandURL=kde-|CommandURL=tde-|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
  372. sed -i 's|K Menu - kde-|TDE Menu - tde-|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
  373. sed -i 's|Name=K Menu|Name=TDE Menu|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
  374. sed -i 's|in KDE stands|in TDE stands|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
  375. sed -i 's| use KDE| use TDE|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
  376. Log "Updating some text strings in khotkeysrc."
  377. sed -i 's|Go to KDE Website|Go to TDE Website|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
  378. sed -i 's|www\.kde\.org|www\.trinitydesktop\.org|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
  379. sed -i 's|KDE3\.1|TDE|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
  380. sed -i 's|kde32b1|trinity2b1|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
  381. sed -i 's|kde321|trinity21|g' "$PROFILE_DIR/share/config/khotkeysrc" 2>/dev/null
  382. fi
  383. fi
  384. # Fix the some of the same text strings in kglobalshortcutsrc.
  385. if [ "$R14_VERSION" -lt "201309150" ]; then
  386. Log "Updating some text strings in kglobalshortcutsrc."
  387. sed -i 's|Go to KDE Website|Go to TDE Website|g' "$PROFILE_DIR/share/config/kglobalshortcutsrc" 2>/dev/null
  388. sed -i 's|www\.kde\.org|www\.trinitydesktop\.org|g' "$PROFILE_DIR/share/config/kglobalshortcutsrc" 2>/dev/null
  389. sed -i 's|KDE3\.1|TDE|g' "$PROFILE_DIR/share/config/kglobalshortcutsrc" 2>/dev/null
  390. fi
  391. # Preserve app preferences.
  392. if [ "$R14_VERSION" -lt "201309150" ]; then
  393. if [ -r $PROFILE_DIR/share/config/profilerc ]; then
  394. Log "Updating user-defined app preferences in profilerc."
  395. sed -i 's|Application=kde-|Application=tde-|g' "$PROFILE_DIR/share/config/profilerc" 2>/dev/null
  396. sed -i 's|khtml|tdehtml|' "$PROFILE_DIR/share/config/profilerc" 2>/dev/null
  397. sed -i 's|kfile_|tdefile_|' "$PROFILE_DIR/share/config/profilerc" 2>/dev/null
  398. sed -i 's|kfilereplace|tdefilereplace|' "$PROFILE_DIR/share/config/profilerc" 2>/dev/null
  399. fi
  400. fi
  401. # Preserve kicker/panel icons.
  402. if [ "$R14_VERSION" -lt "201407050" ]; then
  403. if [ -r $PROFILE_DIR/share/config/kickerrc ]; then
  404. Log "Updating kicker/panel customizations in kickerrc."
  405. sed -i 's|StorageId\[\$e\]=kde-|StorageId\[\$e\]=tde-|g' "$PROFILE_DIR/share/config/kickerrc" 2>/dev/null
  406. sed -i '/^\(Favorites\|FirstSeenApps\)/s|\([=,]\)kde-|\1tde-|g' "$PROFILE_DIR/share/config/kickerrc" 2>/dev/null
  407. else
  408. Log "kickerrc does not exist."
  409. fi
  410. fi
  411. if [ "$R14_VERSION" -lt "201309150" ]; then
  412. if [ -r $PROFILE_DIR/share/config/systemtray_panelappletrc ]; then
  413. Log "Updating system tray icons in systemtray_panelappletrc."
  414. sed -i -e "s|Krandr|Tderandr|g" \
  415. -e "s|Kwallet|Tdewallet|g" \
  416. -e "s|Knetworkmanager|Tdenetworkmanager|g" \
  417. -e "s|Kradio|Tderadio|g" \
  418. $PROFILE_DIR/share/config/systemtray_panelappletrc
  419. fi
  420. fi
  421. if [ "$R14_VERSION" -lt "201309150" ]; then
  422. if [ -r $PROFILE_DIR/share/config/katerc ]; then
  423. Log "Updating katerc."
  424. sed -i 's|ktexteditor_|tdetexteditor_|g' "$PROFILE_DIR/share/config/katerc" 2>/dev/null
  425. else
  426. Log "katerc does not exist."
  427. fi
  428. fi
  429. if [ "$R14_VERSION" -lt "201309150" ]; then
  430. if [ -r $PROFILE_DIR/share/config/kwriterc ]; then
  431. Log "Updating kwriterc."
  432. sed -i 's|ktexteditor_|tdetexteditor_|g' "$PROFILE_DIR/share/config/kwriterc" 2>/dev/null
  433. else
  434. Log "kwriterc does not exist."
  435. fi
  436. fi
  437. if [ "$R14_VERSION" -lt "201401070" ]; then
  438. if [ -r $PROFILE_DIR/share/config/keditrc ]; then
  439. Log "Updating keditrc."
  440. sed -i 's|ktexteditor_|tdetexteditor_|g' "$PROFILE_DIR/share/config/keditrc" 2>/dev/null
  441. else
  442. Log "keditrc does not exist."
  443. fi
  444. fi
  445. if [ "$R14_VERSION" -lt "201401070" ]; then
  446. if [ -r $PROFILE_DIR/share/config/quantarc ]; then
  447. Log "Updating quantarc."
  448. sed -i 's|ktexteditor_|tdetexteditor_|g' "$PROFILE_DIR/share/config/quantarc" 2>/dev/null
  449. else
  450. Log "quantarc does not exist."
  451. fi
  452. fi
  453. if [ "$R14_VERSION" -lt "201401070" ]; then
  454. # kdeveloprc is renamed to tdeveloprc later in this script. As we don't know whether
  455. # this script is being run the first time or any subsequent time, we look for both rc files.
  456. if [ -r $PROFILE_DIR/share/config/tdeveloprc ]; then
  457. DEVELOP_RC_FILE="$PROFILE_DIR/share/config/tdeveloprc"
  458. elif [ -r $PROFILE_DIR/share/config/kdeveloprc ]; then
  459. DEVELOP_RC_FILE="$PROFILE_DIR/share/config/kdeveloprc"
  460. fi
  461. if [ "$DEVELOP_RC_FILE" != "" ]; then
  462. Log "Updating `basename $DEVELOP_RC_FILE`."
  463. sed -i 's|ktexteditor_|tdetexteditor_|g' "$DEVELOP_RC_FILE" 2>/dev/null
  464. unset DEVELOP_RC_FILE
  465. else
  466. Log "[tk]developrc does not exist."
  467. fi
  468. fi
  469. if [ "$R14_VERSION" -lt "201401131" ]; then
  470. if [ -r $PROFILE_DIR/share/config/khelpcenterrc ]; then
  471. Log "Updating khelpcenterrc."
  472. sed -i 's|kde_application_manuals|tde_application_manuals|g' "$PROFILE_DIR/share/config/khelpcenterrc" 2>/dev/null
  473. else
  474. Log "khelpcenterrc does not exist."
  475. fi
  476. fi
  477. if [ "$R14_VERSION" -lt "201401070" ]; then
  478. if [ -r $PROFILE_DIR/share/apps/kate/kateui.rc ]; then
  479. Log "Updating kateui.rc."
  480. sed -i 's|ktexteditor_|tdetexteditor_|g' "$PROFILE_DIR/share/apps/kate/kateui.rc" 2>/dev/null
  481. else
  482. Log "kateui.rc does not exist."
  483. fi
  484. fi
  485. if [ "$R14_VERSION" -lt "201401070" ]; then
  486. if [ -r $PROFILE_DIR/share/apps/katepart/katepartui.rc ]; then
  487. Log "Updating katepartui.rc."
  488. sed -i 's|ktexteditor_|tdetexteditor_|g' "$PROFILE_DIR/share/apps/katepart/katepartui.rc" 2>/dev/null
  489. else
  490. Log "katepartui.rc does not exist."
  491. fi
  492. fi
  493. if [ "$R14_VERSION" -lt "201401070" ]; then
  494. if [ -r $PROFILE_DIR/share/apps/kwrite/kwriteui.rc ]; then
  495. Log "Updating kwriteui.rc."
  496. sed -i 's|ktexteditor_|tdetexteditor_|g' "$PROFILE_DIR/share/apps/kwrite/kwriteui.rc" 2>/dev/null
  497. else
  498. Log "kwriteui.rc does not exist."
  499. fi
  500. fi
  501. if [ "$R14_VERSION" -lt "201401070" ]; then
  502. if [ -d $PROFILE_DIR/share/apps/ktexteditor_kdatatool ]; then
  503. Log "Updating ktexteditor_kdatatool."
  504. # First rename any existing file inside the directory.
  505. if [ -r $PROFILE_DIR/share/apps/ktexteditor_kdatatool/ktexteditor_kdatatoolui.rc ]; then
  506. mv $PROFILE_DIR/share/apps/ktexteditor_kdatatool/ktexteditor_kdatatoolui.rc $PROFILE_DIR/share/apps/ktexteditor_kdatatool/tdetexteditor_kdatatoolui.rc
  507. sed -i 's|ktexteditor_|tdetexteditor_|g' "$PROFILE_DIR/share/apps/ktexteditor_kdatatool/tdetexteditor_kdatatoolui.rc" 2>/dev/null
  508. fi
  509. # Now rename the directory.
  510. mv $PROFILE_DIR/share/apps/ktexteditor_kdatatool $PROFILE_DIR/share/apps/tdetexteditor_kdatatool
  511. else
  512. Log "ktexteditor_kdatatool does not exist."
  513. fi
  514. fi
  515. if [ "$R14_VERSION" -lt "201309150" ]; then
  516. if [ -r $PROFILE_DIR/share/apps/ark/ark_part.rc ]; then
  517. Log "Updating ark_part.rc."
  518. sed -i 's|ark_kparts|ark_tdeparts|g' "$PROFILE_DIR/share/apps/ark/ark_part.rc" 2>/dev/null
  519. else
  520. Log "ark_part.rc does not exist."
  521. fi
  522. fi
  523. # Preserve Quick Launch icons.
  524. # There should only be one configuration file, but old KDE3 remnant files might exist from users who
  525. # migrated from KDE3.
  526. if [ "$R14_VERSION" -lt "201309150" ]; then
  527. Log "Updating Quick Launch applet."
  528. if [ -r "$PROFILE_DIR/share/config/kickerrc" ]; then
  529. QUICK_LAUNCH_CONFIG="`grep launcher_panelapplet $PROFILE_DIR/share/config/kickerrc | awk -F = '{print $2}'`"
  530. if [ "$QUICK_LAUNCH_CONFIG" != "" ]; then
  531. sed -i 's|,kde-|,tde-|g' "$PROFILE_DIR/share/config/$QUICK_LAUNCH_CONFIG" 2>/dev/null
  532. else
  533. Log "Quick Launch is not installed."
  534. fi
  535. else
  536. Log "Quick Launch is not installed."
  537. fi
  538. fi
  539. if [ "$R14_VERSION" -lt "201402020" ]; then
  540. Log "Updating Quanta Plus plugins.rc."
  541. if [ -r $PROFILE_DIR/share/apps/quanta/plugins.rc ]; then
  542. sed -i 's|FileName=kde3|FileName=trinity|g' "$PROFILE_DIR/share/apps/quanta/plugins.rc" 2>/dev/null
  543. sed -i 's|FileName=kdemod3|FileName=trinity|g' "$PROFILE_DIR/share/apps/quanta/plugins.rc" 2>/dev/null
  544. sed -i 's|KFileReplace|TDEFileReplace|g' "$PROFILE_DIR/share/apps/quanta/plugins.rc" 2>/dev/null
  545. sed -i 's|kfilereplace|tdefilereplace|g' "$PROFILE_DIR/share/apps/quanta/plugins.rc" 2>/dev/null
  546. else
  547. Log "Quanta Plus plugins.rc does not exist."
  548. fi
  549. fi
  550. # Update sym link files in $USER_DIR/.trinity/Autostart.
  551. if [ "$R14_VERSION" -lt "201309150" ]; then
  552. if [ -d "$PROFILE_DIR/Autostart" ]; then
  553. ( cd "$PROFILE_DIR/Autostart"
  554. Log "Updating Autostart files."
  555. for i in `find . -type l`; do
  556. LINK="`readlink $i`"
  557. LINK_PATH="`dirname $LINK`"
  558. LINK_NAME="`basename $LINK`"
  559. if [ "`echo $LINK_PATH | grep \"$TDEDIR/share/applications/kde\"`" != "" ]; then
  560. NEW_LINK_PATH="`echo \"$LINK_PATH\" | sed 's|/share/applications/kde|/share/applications/tde|'`"
  561. fi
  562. if [ "$NEW_LINK_PATH" != "" ]; then
  563. unlink $i
  564. ln -sf "$NEW_LINK_PATH/$LINK_NAME" "$LINK_NAME"
  565. fi
  566. if [ "$?" != "0" ]; then
  567. Log "There was an error with creating a new sym link for $LINK." 1>&2
  568. KDEGLOBALS_KEY_VALUE="autostart"
  569. fi
  570. done
  571. )
  572. else
  573. Log "Autostart directory not found."
  574. fi
  575. fi
  576. # Ensure all KDED services are accounted for in the user's profile. Any that are missing
  577. # are defaulted to not auto-loading (false). Refer to bug report 1210. This same test is
  578. # performed in the migratekde3 script, but notice the migratekde3 script uses the key of
  579. # X-KDE-Kded-autoload whereas X-TDE-Kded-autoload is used here.
  580. if [ "$R14_VERSION" -lt "201309150" ]; then
  581. if [ -d $PROFILE_DIR/share/services/kded ]; then
  582. if [ "`find $PROFILE_DIR/share/services/kded -name \"*.desktop\"`" != "" ]; then
  583. Log "Validating KDED services."
  584. for i in `/bin/ls -1 $PROFILE_DIR/share/services/kded/*.desktop`; do
  585. SERVICE_NAME=`basename $i`
  586. if [ ! -f $TDEDIR/share/services/kded/$SERVICE_NAME ]; then
  587. $TDEDIR/bin/kwriteconfig --file $i --group "Desktop Entry" --key "X-TDE-Kded-autoload" --type bool "false"
  588. fi
  589. done
  590. fi
  591. fi
  592. fi
  593. # Try to update sessions.
  594. if [ "$R14_VERSION" -lt "201310050" ]; then
  595. Log "Update sessions."
  596. if [ -f $PROFILE_DIR/share/config/ksmserverrc ]; then
  597. sed -i -e 's|kwin|twin|g' \
  598. -e 's|krandr|tderandr|g' \
  599. -e 's|kwallet|tdewallet|g' \
  600. -e 's|kradio|tderadio|g' \
  601. $PROFILE_DIR/share/config/ksmserverrc
  602. fi
  603. if [ -d $PROFILE_DIR/share/config/session ]; then
  604. find $PROFILE_DIR/share/config/session -name "kwin_*" -o -name "kwallet*" -o -name "kradio*" | \
  605. while read i; do
  606. ir=$PROFILE_DIR/share/config/session/$(basename $i | \
  607. sed -e "s|^kwin_|twin_|" \
  608. -e "s|^kwallet|tdewallet|" \
  609. -e "s|^kradio|tderadio|")
  610. mv $i $ir
  611. done
  612. fi
  613. fi
  614. # Update TDENewStuff
  615. if [ "$R14_VERSION" -lt "201410170" ]; then
  616. Log "Updating TDENewStuff providers and status."
  617. find "$PROFILE_DIR"/share/config -type f -print0 2>/dev/null | \
  618. xargs -r0 grep -ZIEl "^\[KNewStuff" | \
  619. xargs -r0 sed -i -e "/^\[KNewStuff/,/^\[|$/{" -e "s|^\[KNewStuff|[TDENewStuff|" -e "s|^ProvidersUrl=[^ ]*|ProvidersUrl=https://www.trinitydesktop.org/ocs/providers.xml|" -e "}"
  620. fi
  621. Log "Renaming some configuration files and directories."
  622. # Note: The only rebranding that occured before starting the R14 branch was krita. All other
  623. # rebranding updates belong in this script.
  624. # Don't force renaming in case this script is used to update an existing Trinity profile. That is,
  625. # always check whether the new config file already exists.
  626. if [ "$R14_VERSION" -lt "201309150" ]; then
  627. if [ ! -f $PROFILE_DIR/share/config/tdeprintrc ] && [ -f $PROFILE_DIR/share/config/kdeprintrc ] || [ -d $PROFILE_DIR/share/apps/kdeprint ]; then
  628. Log " kdeprint->tdeprint"
  629. mv $PROFILE_DIR/share/config/kdeprintrc $PROFILE_DIR/share/config/tdeprintrc 2>/dev/null
  630. mv $PROFILE_DIR/share/apps/kdeprint $PROFILE_DIR/share/apps/tdeprint 2>/dev/null
  631. fi
  632. if [ ! -f $PROFILE_DIR/share/config/tdesurc ] && [ -f $PROFILE_DIR/share/config/kdesurc ]; then
  633. Log " kdesu->tdesu"
  634. mv $PROFILE_DIR/share/config/kdesurc $PROFILE_DIR/share/config/tdesurc 2>/dev/null
  635. fi
  636. if [ ! -f $PROFILE_DIR/share/config/tdeveloprc ] && [ -f $PROFILE_DIR/share/config/kdeveloprc ]; then
  637. Log " kdevelop->tdevelop"
  638. mv $PROFILE_DIR/share/config/kdeveloprc $PROFILE_DIR/share/config/tdeveloprc 2>/dev/null
  639. fi
  640. fi
  641. if [ "$R14_VERSION" -lt "201403020" ]; then
  642. if [ ! -f $PROFILE_DIR/share/config/doctdevtocpluginrc ] && [ -f $PROFILE_DIR/share/config/dockdevtocpluginrc ]; then
  643. Log " dockdevtocpluginrc->doctdevtocpluginrc"
  644. mv $PROFILE_DIR/share/config/dockdevtocpluginrc $PROFILE_DIR/share/config/doctdevtocpluginrc 2>/dev/null
  645. fi
  646. if [ ! -f $PROFILE_DIR/share/config/tdevgrepviewrc ] && [ -f $PROFILE_DIR/share/config/kdevgrepviewrc ]; then
  647. Log " kdevgrepviewrc->tdevgrepviewrc"
  648. mv $PROFILE_DIR/share/config/kdevgrepviewrc $PROFILE_DIR/share/config/tdevgrepviewrc 2>/dev/null
  649. fi
  650. if [ ! -f $PROFILE_DIR/share/config/tdevsnippetrc ] && [ -f $PROFILE_DIR/share/config/kdevsnippetrc ]; then
  651. Log " kdevsnippetrc->tdevsnippetrc"
  652. mv $PROFILE_DIR/share/config/kdevsnippetrc $PROFILE_DIR/share/config/tdevsnippetrc 2>/dev/null
  653. fi
  654. if [ ! -f $PROFILE_DIR/share/config/tdevassistantrc ] && [ -f $PROFILE_DIR/share/config/kdevassistantrc ]; then
  655. Log " kdevassistantrc->tdevassistantrc"
  656. mv $PROFILE_DIR/share/config/kdevassistantrc $PROFILE_DIR/share/config/tdevassistantrc 2>/dev/null
  657. fi
  658. if [ ! -f $PROFILE_DIR/share/config/tdevfileselectorrc ] && [ -f $PROFILE_DIR/share/config/kdevfileselectorrc ]; then
  659. Log " kdevfileselectorrc->tdevfileselectorrc"
  660. mv $PROFILE_DIR/share/config/kdevfileselectorrc $PROFILE_DIR/share/config/tdevfileselectorrc 2>/dev/null
  661. fi
  662. if [ ! -f $PROFILE_DIR/share/config/tdevdesignerrc ] && [ -f $PROFILE_DIR/share/config/kdevdesignerrc ]; then
  663. Log " kdevdesignerrc->tdevdesignerrc"
  664. mv $PROFILE_DIR/share/config/kdevdesignerrc $PROFILE_DIR/share/config/tdevdesignerrc 2>/dev/null
  665. fi
  666. if [ ! -d $PROFILE_DIR/share/apps/tdevdocumentation ] && [ -d $PROFILE_DIR/share/apps/kdevdocumentation ]; then
  667. Log " kdevdocumentation->tdevdocumentation"
  668. mv $PROFILE_DIR/share/apps/kdevdocumentation $PROFILE_DIR/share/apps/tdevdocumentation 2>/dev/null
  669. fi
  670. if [ ! -d $PROFILE_DIR/share/apps/tdevfileselector ] && [ -d $PROFILE_DIR/share/apps/kdevfileselector ]; then
  671. Log " kdevfileselector->tdevfileselector"
  672. mv $PROFILE_DIR/share/apps/kdevfileselector $PROFILE_DIR/share/apps/tdevfileselector 2>/dev/null
  673. fi
  674. if [ ! -d $PROFILE_DIR/share/apps/tdevabbrev ] && [ -d $PROFILE_DIR/share/apps/kdevabbrev ]; then
  675. Log " kdevabbrev->tdevabbrev"
  676. mv $PROFILE_DIR/share/apps/kdevabbrev $PROFILE_DIR/share/apps/tdevabbrev 2>/dev/null
  677. fi
  678. fi
  679. # kwin/twin is the Trinity window manager. kwin4/twin4 is a game.
  680. if [ "$R14_VERSION" -lt "201310190" ]; then
  681. if [ ! -f $PROFILE_DIR/share/config/twinrc ] && [ -f $PROFILE_DIR/share/config/kwinrc ] || [ -f $PROFILE_DIR/share/config/kwinrulesrc ]; then
  682. # Do not include kwinrules_update because that is an auto-generated file.
  683. Log " kwin->twin"
  684. mv $PROFILE_DIR/share/config/kwinrc $PROFILE_DIR/share/config/twinrc 2>/dev/null
  685. mv $PROFILE_DIR/share/config/kwinrc.eventsrc $PROFILE_DIR/share/config/twinrc.eventsrc 2>/dev/null
  686. mv $PROFILE_DIR/share/config/kwinrc $PROFILE_DIR/share/config/twinrc 2>/dev/null
  687. mv $PROFILE_DIR/share/config/kwinrulesrc $PROFILE_DIR/share/config/twinrulesrc 2>/dev/null
  688. mv $PROFILE_DIR/share/config/kwin_rules_dialogrc $PROFILE_DIR/share/config/twin_rules_dialogrc 2>/dev/null
  689. sed -i 's|PluginLib=kwin_|PluginLib=twin_|' $PROFILE_DIR/share/config/twinrc
  690. sed -i 's|PluginLib=kwin3_|PluginLib=twin3_|' $PROFILE_DIR/share/config/twinrc
  691. fi
  692. fi
  693. if [ "$R14_VERSION" -lt "201309150" ]; then
  694. if [ ! -f $PROFILE_DIR/share/config/twin4rc ] && [ -f $PROFILE_DIR/share/config/kwin4rc ]; then
  695. Log " kwin4->twin4"
  696. mv $PROFILE_DIR/share/config/kwin4rc $PROFILE_DIR/share/config/twin4rc 2>/dev/null
  697. fi
  698. if [ ! -d $PROFILE_DIR/share/config/tderesources ] && [ -d $PROFILE_DIR/share/config/kresources ]; then
  699. Log " kresources->tderesources"
  700. mv $PROFILE_DIR/share/config/kresources $PROFILE_DIR/share/config/tderesources 2>/dev/null
  701. fi
  702. if [ ! -f $PROFILE_DIR/share/config/tdeab2tdeabcrc ] && [ -f $PROFILE_DIR/share/config/kab2kabcrc ]; then
  703. Log " kab2kabc->tdeab2tdeabc"
  704. mv $PROFILE_DIR/share/config/kab2kabcrc $PROFILE_DIR/share/config/tdeab2tdeabcrc 2>/dev/null
  705. fi
  706. if [ ! -f $PROFILE_DIR/share/config/tdeconf_updaterc ] && [ -f $PROFILE_DIR/share/config/kconf_updaterc ]; then
  707. Log " kconf_update->tdeconf_update"
  708. mv $PROFILE_DIR/share/config/kconf_updaterc $PROFILE_DIR/share/config/tdeconf_updaterc 2>/dev/null
  709. mv $PROFILE_DIR/share/apps/kconf_update $PROFILE_DIR/share/apps/tdeconf_update 2>/dev/null
  710. fi
  711. if [ ! -f $PROFILE_DIR/share/config/tdeio_httprc ] && [ -f $PROFILE_DIR/share/config/kio_httprc ]; then
  712. Log " kio_http->tdeio_http"
  713. mv $PROFILE_DIR/share/config/kio_httprc $PROFILE_DIR/share/config/tdeio_httprc 2>/dev/null
  714. fi
  715. if [ ! -f $PROFILE_DIR/share/config/tdeio_ftprc ] && [ -f $PROFILE_DIR/share/config/kio_ftprc ]; then
  716. Log " kio_ftp->tdeio_ftp"
  717. mv $PROFILE_DIR/share/config/kio_ftprc $PROFILE_DIR/share/config/tdeio_ftprc 2>/dev/null
  718. mv $PROFILE_DIR/share/apps/kio_ftp $PROFILE_DIR/share/apps/tdeio_ftp 2>/dev/null
  719. fi
  720. if [ ! -f $PROFILE_DIR/share/config/tdeioslaverc ] && [ -f $PROFILE_DIR/share/config/kioslaverc ]; then
  721. Log " kioslave->tdeioslave"
  722. mv $PROFILE_DIR/share/config/kioslaverc $PROFILE_DIR/share/config/tdeioslaverc 2>/dev/null
  723. fi
  724. if [ ! -f $PROFILE_DIR/share/config/tdelaunchrc ] && [ -f $PROFILE_DIR/share/config/klaunchrc ]; then
  725. Log " klaunch->tdelaunch"
  726. mv $PROFILE_DIR/share/config/klaunchrc $PROFILE_DIR/share/config/tdelaunchrc 2>/dev/null
  727. fi
  728. if [ ! -f $PROFILE_DIR/share/config/tderandrtrayrc ] && [ -f $PROFILE_DIR/share/config/krandrtrayrc ]; then
  729. Log " krandrtray->tderandrtray"
  730. mv $PROFILE_DIR/share/config/krandrtrayrc $PROFILE_DIR/share/config/tderandrtrayrc 2>/dev/null
  731. fi
  732. if [ ! -f $PROFILE_DIR/share/config/tdewalletrc ] && [ -f $PROFILE_DIR/share/config/kwalletrc ]; then
  733. Log " kwallet->tdewallet"
  734. mv $PROFILE_DIR/share/config/kwalletrc $PROFILE_DIR/share/config/tdewalletrc 2>/dev/null
  735. mv $PROFILE_DIR/share/apps/kwallet $PROFILE_DIR/share/apps/tdewallet 2>/dev/null
  736. fi
  737. if [ ! -d $PROFILE_DIR/share/apps/tdefile ] && [ -d $PROFILE_DIR/share/apps/kfile ]; then
  738. Log " kfile->tdefile"
  739. mv $PROFILE_DIR/share/apps/kfile $PROFILE_DIR/share/apps/tdefile 2>/dev/null
  740. fi
  741. if [ ! -f $PROFILE_DIR/share/config/tdehtmlrc ] && [ -f $PROFILE_DIR/share/config/khtmlrc ]; then
  742. Log " khtml->tdehtml"
  743. mv $PROFILE_DIR/share/config/khtmlrc $PROFILE_DIR/share/config/tdehtmlrc 2>/dev/null
  744. mv $PROFILE_DIR/share/apps/khtml $PROFILE_DIR/share/apps/tdehtml 2>/dev/null
  745. fi
  746. if [ ! -f $PROFILE_DIR/share/config/tdeio_camerarc ] && [ -f $PROFILE_DIR/share/config/kio_camerarc ]; then
  747. Log " kio_camera->tdeio_camera"
  748. mv $PROFILE_DIR/share/config/kio_camerarc $PROFILE_DIR/share/config/tdeio_camerarc 2>/dev/null
  749. fi
  750. if [ ! -f $PROFILE_DIR/share/config/tdeio_thumbnailrc ] && [ -f $PROFILE_DIR/share/config/kio_thumbnailrc ]; then
  751. Log " kio_thumbnail->tdeio_thumbnail"
  752. mv $PROFILE_DIR/share/config/kio_thumbnailrc $PROFILE_DIR/share/config/tdeio_thumbnailrc 2>/dev/null
  753. fi
  754. if [ ! -f $PROFILE_DIR/share/config/tdeio_locaterc ] && [ -f $PROFILE_DIR/share/config/kio_locaterc ]; then
  755. Log " kio_locate->tdeio_locate"
  756. mv $PROFILE_DIR/share/config/kio_locaterc $PROFILE_DIR/share/config/tdeio_locaterc 2>/dev/null
  757. fi
  758. if [ ! -f $PROFILE_DIR/share/config/tdeio_aptrc ] && [ -f $PROFILE_DIR/share/config/kio_aptrc ]; then
  759. Log " kio_apt->tdeio_apt"
  760. mv $PROFILE_DIR/share/config/kio_aptrc $PROFILE_DIR/share/config/tdeio_aptrc 2>/dev/null
  761. fi
  762. if [ ! -f $PROFILE_DIR/share/config/tderadiorc ] && [ -f $PROFILE_DIR/share/config/kradiorc ]; then
  763. Log " kradio->tderadio"
  764. mv $PROFILE_DIR/share/config/kradiorc $PROFILE_DIR/share/config/tderadiorc 2>/dev/null
  765. mv $PROFILE_DIR/share/apps/kradio $PROFILE_DIR/share/apps/tderadio 2>/dev/null
  766. fi
  767. if [ ! -f $HOME/.tderc ] && [ -f $HOME/.kderc ]; then
  768. # Do not blindly move $HOME/.kderc because that file might be from KDE4.
  769. # The first test is from a Trinity .kderc and the second test is from a KDE4 .kderc.
  770. if [ "`grep selectBackground $HOME/.kderc`" != "" ] && [ "`grep smallestReadableFont $HOME/.kderc`" = "" ]; then
  771. # Both tests pass. Probably a Trinity .kderc.
  772. Log " .kderc->.tderc"
  773. mv $HOME/.kderc $HOME/.tderc 2>/dev/null
  774. fi
  775. fi
  776. fi
  777. if [ "$R14_VERSION" -lt "201401070" ]; then
  778. if [ ! -d $PROFILE_DIR/share/apps/tdestyle ] && [ -d $PROFILE_DIR/share/apps/kstyle ]; then
  779. Log " kstyle->tdestyle"
  780. mv $PROFILE_DIR/share/apps/kstyle $PROFILE_DIR/share/apps/tdestyle 2>/dev/null
  781. fi
  782. fi
  783. if [ "$R14_VERSION" -lt "201309150" ]; then
  784. # Copy the following two rc files rather than move because the older versions are needed for HAL systems.
  785. if [ ! -f $PROFILE_DIR/share/config/tdenetworkmanagerrc ] && [ -f $PROFILE_DIR/share/config/knetworkmanagerrc ]; then
  786. Log " knetworkmanager->tdenetworkmanager"
  787. cp -a $PROFILE_DIR/share/config/knetworkmanagerrc $PROFILE_DIR/share/config/tdenetworkmanagerrc 2>/dev/null
  788. fi
  789. if [ ! -f $PROFILE_DIR/share/config/tdepowersaverc ] && [ -f $PROFILE_DIR/share/config/kpowersaverc ]; then
  790. Log " kpowersave->tdepowersave"
  791. cp -a $PROFILE_DIR/share/config/kpowersaverc $PROFILE_DIR/share/config/tdepowersaverc 2>/dev/null
  792. fi
  793. fi
  794. if [ "$R14_VERSION" -lt "201401050" ]; then
  795. if [ ! -f $PROFILE_DIR/share/config/tdedebugdialogrc ] && [ -f $PROFILE_DIR/share/config/kdebugdialogrc ]; then
  796. Log " kdebugdialog->tdedebugdialog"
  797. mv $PROFILE_DIR/share/config/kdebugdialogrc $PROFILE_DIR/share/config/tdedebugdialogrc 2>/dev/null
  798. fi
  799. fi
  800. if [ "$R14_VERSION" -lt "201401150" ]; then
  801. if [ ! -f $PROFILE_DIR/share/config/tdefilereplacerc ] && [ -f $PROFILE_DIR/share/config/kfilereplacerc ]; then
  802. Log " kfilereplace->tdefilereplace"
  803. mv $PROFILE_DIR/share/config/kfilereplacerc $PROFILE_DIR/share/config/tdefilereplacerc 2>/dev/null
  804. fi
  805. fi
  806. if [ "$R14_VERSION" -lt "201401052" ]; then
  807. # Rename the user's custom launcher menu.
  808. # Before the release of R14.0.0, custom user menus had the same file name as KDE4:
  809. # applications-kmenuedit.menu. Under that condition, there is a possibility the user
  810. # was using the same custom menu for both Trinity and KDE4. To distinguish whether a
  811. # custom menu is TDE or KDE4, search the menu for TDE-specific and KDE4-specific menu
  812. # items. There is a possibility the user has customized a common menu to include or
  813. # exclude all of these items. Later we will copy any existing custom menu.
  814. # There are three environments to inherit:
  815. # KDE4
  816. # KDE/TDE 3.5.x
  817. # TDE pre R14
  818. if [ -f $USER_DIR/.config/menus/applications-tdemenuedit.menu ]; then
  819. CUSTOM_MENU="TDE"
  820. elif [ -f $USER_DIR/.config/menus/applications-kmenuedit.menu ]; then
  821. if [ "`grep \"kde4-kfind.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ] || \
  822. [ "`grep \"kde4-Help.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ]; then
  823. CUSTOM_MENU="KDE4"
  824. elif [ "`grep \"kde-kfind.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ] || \
  825. [ "`grep \"kde-Help.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ]; then
  826. # KDE/TDE 3.5.x
  827. CUSTOM_MENU="KDE"
  828. elif [ "`grep \"tde-Kfind.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ] || \
  829. [ "`grep \"tde-Help.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ] || \
  830. [ "`grep \"tde-Home.desktop\" $USER_DIR/.config/menus/applications-kmenuedit.menu`" ]; then
  831. CUSTOM_MENU="TDE"
  832. fi
  833. # Now we know which type of environment. Copy the existing menu.
  834. Log " kmenuedit.menu($CUSTOM_MENU)->tdemenuedit.menu"
  835. # Note: at this point the layout of a renamed KDE4 custom menu will not be the same as Trinity.
  836. # We'll fix that later.
  837. cp $USER_DIR/.config/menus/applications-kmenuedit.menu $USER_DIR/.config/menus/applications-tdemenuedit.menu 2>/dev/null
  838. fi
  839. fi
  840. if [ "$R14_VERSION" -lt "202004080" ]; then
  841. # Update the user's custom menu. Any custom menu should have been renamed a few lines above.
  842. if [ -r $USER_DIR/.config/menus/applications-tdemenuedit.menu ]; then
  843. sed -n "s|^\s*<Filename>kde-\(.*\)<\/Filename>\s*$|\1|p" \
  844. < "$USER_DIR/.config/menus/applications-tdemenuedit.menu" \
  845. > "${CACHE_DIR}/${SCRIPT_NAME}-tdemenu-rename.txt"
  846. cat "${CACHE_DIR}/${SCRIPT_NAME}-tdemenu-rename.txt" | \
  847. while read kde_filename; do
  848. if [ -f "$USER_DIR/.local/share/applications/kde-$kde_filename" ]; then
  849. if [ -f "$USER_DIR/.local/share/applications/tde-$kde_filename" ]; then
  850. continue
  851. else
  852. mv "$USER_DIR/.local/share/applications/kde-$kde_filename" \
  853. "$USER_DIR/.local/share/applications/tde-$kde_filename"
  854. fi
  855. fi
  856. sed -i 's|<Filename>kde-$kde_filename|<Filename>tde-$kde_filename|g' \
  857. $USER_DIR/.config/menus/applications-tdemenuedit.menu
  858. done
  859. rm "${CACHE_DIR}/${SCRIPT_NAME}-tdemenu-rename.txt"
  860. fi
  861. fi
  862. if [ "$R14_VERSION" -lt "201401130" ]; then
  863. Log "Updating profile *.desktop files."
  864. # First update *.desktop files in the Trinity profile folder. Updating these files is safe.
  865. find "$PROFILE_DIR" -name "*.desktop" -print0 2>/dev/null | \
  866. xargs -r0 grep -ZIl "\(X-KDE-\|KDE;\|kdesu\)" | \
  867. xargs -r0 sed -i -e "s|X-KDE-|X-TDE-|g" -e "s|KDE;|TDE;|g" -e "s|kdesu|tdesu|g"
  868. # Next update *.desktop files in $USER_DIR/.local.
  869. # Any existing applications-kmenuedit.menu has been copied to applications-tdemenuedit.menu.
  870. if [ -f "$USER_DIR/.config/menus/applications-tdemenuedit.menu" ] && [ "$CUSTOM_MENU" != "TDE" ]; then
  871. # KDE/TDE 3.5.x or converted KDE4. No need to update a pre R14 menu.
  872. Log "Updating ~/.local *.desktop files."
  873. find "$USER_DIR/.local" -name "*.desktop" -print0 2>/dev/null | \
  874. xargs -r0 grep -ZIl "\(X-KDE-\|KDE;\|kdesu\)" | \
  875. xargs -r0 sed -i -e "s|X-KDE-|X-TDE-|g" -e "s|KDE;|TDE;|g" -e "s|kdesu|tdesu|g"
  876. # When the custom menu is from KDE/TDE 3.5.x or pre R14, then we are done.
  877. # When the custom menu is from KDE4, we have additional work to perform because the KDE4
  878. # layout structure is different from the Trinity layout.
  879. # In limited tests the following menu items are out of place when migrating a KDE4 menu:
  880. # Edutainment (because KDE4 uses 'Education' rather than 'Edutainment'
  881. # Find Files/Folders (because of kde4- prefix rather than tde- prefix)
  882. # Help (because of kde4- prefix rather than tde- prefix)
  883. # Home - Personal Files (because of kde4- prefix rather than tde- prefix)
  884. # All four items are placed at the top of the migrated menu.
  885. # The following should fix the layout to conform to Trinity.
  886. if [ "$CUSTOM_MENU" = "KDE4" ]; then
  887. Log "Repairing menu layout structure."
  888. sed -i -e "s|Education|Edutainment|" -e "s|kde4-|tde-|g" $USER_DIR/.config/menus/applications-tdemenuedit.menu
  889. # The following must be performed in this order.
  890. sed -i "s|tde-Help.desktop|tde-Home.desktop|" $USER_DIR/.config/menus/applications-tdemenuedit.menu
  891. sed -i "s|tde-kfind.desktop|tde-Help.desktop|" $USER_DIR/.config/menus/applications-tdemenuedit.menu
  892. sed -i "s|<Menuname>Applications</Menuname>|<Filename>tde-Kfind.desktop</Filename>|" $USER_DIR/.config/menus/applications-tdemenuedit.menu
  893. # Also need to fix Lost+Found? Lost+Found is not in alphabetical order
  894. # when opening the menu editor against the converted menu.
  895. fi
  896. fi
  897. fi
  898. # Disable some features new to R14, otherwise users will see an unfamiliar desktop.
  899. if [ "$R14_VERSION" -lt "201309150" ]; then
  900. if [ $($TDEDIR/bin/kreadconfig --file kickerrc --group "General" --key "ShowDeepButtons" --default false) = "false" ]; then
  901. $TDEDIR/bin/kwriteconfig --file kickerrc --group "General" --key "ShowDeepButtons" --type bool "false"
  902. fi
  903. if [ $($TDEDIR/bin/kreadconfig --file kickerrc --group "General" --key "UseResizeHandle" --default false) = "false" ]; then
  904. $TDEDIR/bin/kwriteconfig --file kickerrc --group "General" --key "UseResizeHandle" --type bool "false"
  905. fi
  906. if [ $($TDEDIR/bin/kreadconfig --file kickerrc --group "General" --key "MenubarPanelBlurred" --default false) = "false" ]; then
  907. $TDEDIR/bin/kwriteconfig --file kickerrc --group "General" --key "MenubarPanelBlurred" --type bool "false"
  908. fi
  909. fi
  910. if [ "$R14_VERSION" -lt "201412270" ]; then
  911. if [ ! -d $PROFILE_DIR/share/apps/tdeabc ] && [ -d $PROFILE_DIR/share/apps/kabc ]; then
  912. Log " kabc->tdeabc"
  913. mv $PROFILE_DIR/share/apps/kabc $PROFILE_DIR/share/apps/tdeabc 2>/dev/null
  914. fi
  915. fi
  916. # Rename/remove old link files in Konqueror sidebar network panel.
  917. # Updated links will be installed when the user open the panel from Konqueror
  918. if [ "$R14_VERSION" -lt "201805260" ]; then
  919. if [ -f "$PROFILE_DIR/share/apps/konqsidebartng/virtual_folders/remote/ftp/kde_ftp.desktop" ]; then
  920. if [ -f "$PROFILE_DIR/share/apps/konqsidebartng/virtual_folders/remote/ftp/tde_ftp.desktop" ]; then
  921. Log " Remove kde_ftp.desktop"
  922. rm "$PROFILE_DIR/share/apps/konqsidebartng/virtual_folders/remote/ftp/kde_ftp.desktop" 2>/dev/null
  923. else
  924. Log " kde_ftp.desktop->tde_ftp.desktop"
  925. mv "$PROFILE_DIR/share/apps/konqsidebartng/virtual_folders/remote/ftp/kde_ftp.desktop" \
  926. "$PROFILE_DIR/share/apps/konqsidebartng/virtual_folders/remote/ftp/tde_ftp.desktop" 2>/dev/null
  927. fi
  928. fi
  929. if [ -f "$PROFILE_DIR/share/apps/konqsidebartng/virtual_folders/remote/web/kde_web.desktop" ]; then
  930. if [ -f "$PROFILE_DIR/share/apps/konqsidebartng/virtual_folders/remote/web/tde_web.desktop" ]; then
  931. Log " Remove kde_web.desktop"
  932. rm "$PROFILE_DIR/share/apps/konqsidebartng/virtual_folders/remote/web/kde_web.desktop" 2>/dev/null
  933. else
  934. Log " kde_web.desktop->tde_web.desktop"
  935. mv "$PROFILE_DIR/share/apps/konqsidebartng/virtual_folders/remote/web/kde_web.desktop" \
  936. "$PROFILE_DIR/share/apps/konqsidebartng/virtual_folders/remote/web/tde_web.desktop" 2>/dev/null
  937. fi
  938. fi
  939. if [ -f "$PROFILE_DIR/share/apps/konqsidebartng/virtual_folders/remote/web/look_web.desktop" ]; then
  940. Log " Remove look_web.desktop"
  941. rm "$PROFILE_DIR/share/apps/konqsidebartng/virtual_folders/remote/web/look_web.desktop" 2>/dev/null
  942. fi
  943. fi
  944. # Rename startkde/exitkde events if possible
  945. if [ "$R14_VERSION" -lt "201811010" ]; then
  946. if [ -f $PROFILE_DIR/share/config/knotify.eventsrc ]; then
  947. if [ "`grep \"\[startkde\]\" $PROFILE_DIR/share/config/knotify.eventsrc`" ] && \
  948. [ -z "`grep \"\[starttde\]\" $PROFILE_DIR/share/config/knotify.eventsrc`" ]; then
  949. Log " Rename startkde -> starttde"
  950. sed -i "s|\[startkde\]|\[starttde\]|" $PROFILE_DIR/share/config/knotify.eventsrc
  951. fi
  952. if [ "`grep \"\[exitkde\]\" $PROFILE_DIR/share/config/knotify.eventsrc`" ] && \
  953. [ -z "`grep \"\[exittde\]\" $PROFILE_DIR/share/config/knotify.eventsrc`" ]; then
  954. Log " Rename exitkde -> exittde"
  955. sed -i "s|\[exitkde\]|\[exittde\]|" $PROFILE_DIR/share/config/knotify.eventsrc
  956. fi
  957. fi
  958. fi
  959. # Perform some nominal update validations.
  960. # First clean house from any previous failures.
  961. if [ "$CACHE_DIR" = "" ]; then
  962. CACHE_DIR=$PROFILE_DIR
  963. fi
  964. if [ -d "$CACHE_DIR" ]; then
  965. rm -f ${CACHE_DIR}/${SCRIPT_NAME}-*test*.txt 2>/dev/null
  966. else
  967. # Create this directory in case the migratekde3 script was run immediately
  968. # before this script, which means the cache directory will not yet exist.
  969. mkdir "$CACHE_DIR"
  970. fi
  971. # This first test includes *.desktop files in the profile Autostart directory.
  972. TEST_NUM="1"
  973. R14_UPDATE_TEST1=""
  974. find "$PROFILE_DIR" -name "*.desktop" -print0 2>/dev/null | \
  975. xargs -r0 grep -IFl "X-KDE-" >${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt
  976. if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt ]; then
  977. R14_UPDATE_TEST1="failed"
  978. MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\nCheck *.desktop files for 'X-KDE' in\n${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt.\n\n"
  979. Validation_Failure
  980. else
  981. rm -f ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>/dev/null
  982. fi
  983. TEST_NUM="2"
  984. R14_UPDATE_TEST2=""
  985. find "$PROFILE_DIR" -name "*.desktop" -print0 2>/dev/null | \
  986. xargs -r0 grep -IFl "KDE;" >${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt
  987. if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt ]; then
  988. R14_UPDATE_TEST2="failed"
  989. MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\nCheck *.desktop files for 'KDE;' in\n${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt.\n\n"
  990. Validation_Failure
  991. else
  992. rm -f ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>/dev/null
  993. fi
  994. TEST_NUM="3"
  995. R14_UPDATE_TEST3=""
  996. find "$PROFILE_DIR" \
  997. -path $PROFILE_DIR/share/apps/amarok/albumcovers -prune -o \
  998. -path $PROFILE_DIR/share/apps/basket/baskets -prune -o \
  999. -path $PROFILE_DIR/share/apps/juk/covers -prune -o \
  1000. -path $PROFILE_DIR/share/apps/kget/logs -prune -o \
  1001. -path $PROFILE_DIR/share/apps/kmail/autosave -prune -o \
  1002. -path $PROFILE_DIR/share/apps/kmail/dimap -prune -o \
  1003. -path $PROFILE_DIR/share/apps/kmail/imap -prune -o \
  1004. -path $PROFILE_DIR/share/apps/kmail/mail -prune -o \
  1005. -path $PROFILE_DIR/share/apps/kmail/search -prune -o \
  1006. -path $PROFILE_DIR/share/apps/knotes -prune -o \
  1007. -path $PROFILE_DIR/share/apps/kopete/logs -prune -o \
  1008. -type f -print0 2>/dev/null | \
  1009. xargs -r0 grep -IFl "$TDEDIR/share/applications/kde" >${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt
  1010. if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt ]; then
  1011. R14_UPDATE_TEST3="failed"
  1012. MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\nCheck files for '$TDEDIR/share/applications/kde' in\n${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt. "
  1013. Validation_Failure
  1014. else
  1015. rm -f ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>/dev/null
  1016. fi
  1017. TEST_NUM="4"
  1018. R14_UPDATE_TEST4=""
  1019. if [ -r "$PROFILE_DIR/share/config/khotkeysrc" ]; then
  1020. grep "CommandURL=kde-" "$PROFILE_DIR/share/config/khotkeysrc" > ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>&1
  1021. if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt ]; then
  1022. R14_UPDATE_TEST4="failed"
  1023. MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\nCheck khotkeysrc for 'CommandURL=kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt. "
  1024. else
  1025. rm -f ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>/dev/null
  1026. fi
  1027. fi
  1028. TEST_NUM="5"
  1029. R14_UPDATE_TEST5=""
  1030. if [ -r "$PROFILE_DIR/share/config/khotkeysrc" ]; then
  1031. grep "K Menu - kde-" "$PROFILE_DIR/share/config/khotkeysrc" > ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>&1
  1032. if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt ]; then
  1033. R14_UPDATE_TEST5="failed"
  1034. MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\nCheck khotkeysrc for 'K Menu - kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt. "
  1035. Validation_Failure
  1036. else
  1037. rm -f ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>/dev/null
  1038. fi
  1039. fi
  1040. TEST_NUM="6"
  1041. R14_UPDATE_TEST6=""
  1042. if [ -r $PROFILE_DIR/share/config/profilerc ]; then
  1043. grep "Application=kde-" "$PROFILE_DIR/share/config/profilerc" > ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>&1
  1044. if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt ]; then
  1045. R14_UPDATE_TEST6="failed"
  1046. MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\nCheck profilerc for 'Application=kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt. "
  1047. Validation_Failure
  1048. else
  1049. rm -f ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>/dev/null
  1050. fi
  1051. fi
  1052. TEST_NUM="7"
  1053. R14_UPDATE_TEST7=""
  1054. if [ -r $PROFILE_DIR/share/config/kickerrc ]; then
  1055. grep "StorageId\[\$e\]=kde-" "$PROFILE_DIR/share/config/kickerrc" > ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>&1
  1056. if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt ]; then
  1057. R14_UPDATE_TEST7="failed"
  1058. MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\nCheck kickerrc for 'StorageId[$e]=kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt. "
  1059. Validation_Failure
  1060. else
  1061. rm -f ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>/dev/null
  1062. fi
  1063. fi
  1064. TEST_NUM="8"
  1065. R14_UPDATE_TEST8=""
  1066. if [ "$QUICK_LAUNCH_CONFIG" != "" ]; then
  1067. grep "kde-" "$PROFILE_DIR/share/config/$QUICK_LAUNCH_CONFIG" > ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>&1
  1068. if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt ]; then
  1069. R14_UPDATE_TEST8="failed"
  1070. MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\nCheck $QUICK_LAUNCH_CONFIG for 'kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt. "
  1071. Validation_Failure
  1072. else
  1073. rm -f ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>/dev/null
  1074. fi
  1075. fi
  1076. TEST_NUM="9"
  1077. R14_UPDATE_TEST9=""
  1078. if [ -r $USER_DIR/.config/menus/applications-tdemenuedit.menu ]; then
  1079. grep "<Filename>kde-" "$USER_DIR/.config/menus/applications-tdemenuedit.menu" > ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>&1
  1080. if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt ]; then
  1081. R14_UPDATE_TEST9="failed"
  1082. MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\nCheck applications-tdemenuedit.menu for '<Filename>kde-' in\n${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt. "
  1083. Validation_Failure
  1084. else
  1085. rm -f ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>/dev/null
  1086. fi
  1087. fi
  1088. TEST_NUM="10"
  1089. R14_UPDATE_TEST10=""
  1090. find "$PROFILE_DIR" -name "*.desktop" -print0 2>/dev/null | \
  1091. xargs -r0 grep -IFl "kdesu" >${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt
  1092. if [ -s ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt ]; then
  1093. R14_UPDATE_TEST10="failed"
  1094. MESSAGE="Some Trinity profile R14 XDG compliance updates failed.\nCheck *.desktop files for 'kdesu' in\n${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt. "
  1095. Validation_Failure
  1096. else
  1097. rm -f ${CACHE_DIR}/${SCRIPT_NAME}-validation-test${TEST_NUM}.txt 2>/dev/null
  1098. fi
  1099. if [ "$R14_UPDATE_TEST1" = "" ] && [ "$R14_UPDATE_TEST2" = "" ] && [ "$R14_UPDATE_TEST3" = "" ] \
  1100. && [ "$R14_UPDATE_TEST4" = "" ] && [ "$R14_UPDATE_TEST5" = "" ] && [ "$R14_UPDATE_TEST6" = "" ] \
  1101. && [ "$R14_UPDATE_TEST7" = "" ] && [ "$R14_UPDATE_TEST8" = "" ] && [ "$R14_UPDATE_TEST9" = "" ] \
  1102. && [ "$R14_UPDATE_TEST10" = "" ]; then
  1103. $TDEDIR/bin/kwriteconfig --file "$PROFILE_DIR/share/config/kdeglobals" --group "R14 XDG Updates" --key Updated --type bool "true"
  1104. $TDEDIR/bin/kwriteconfig --file "$PROFILE_DIR/share/config/kdeglobals" --group "R14 XDG Updates" --key Version "$SCRIPT_VERSION"
  1105. Log "R14 XDG updates completed successfully."
  1106. else
  1107. # Don't use the --type parameter here because the value no longer is boolean.
  1108. $TDEDIR/bin/kwriteconfig --file "$PROFILE_DIR/share/config/kdeglobals" --group "R14 XDG Updates" --key Updated "$KDEGLOBALS_KEY_VALUE"
  1109. MESSAGE="The r14-xdg-update script did not complete successfully.\n\nThe script will run with each login until all issues are corrected\n(usually one more time is enough).\n\nPlease contact an administrator or take appropriate admininstrative\naction should the problems persist for more than three reboot attempts.\n\nThe error code is $KDEGLOBALS_KEY_VALUE.\n\nCommon failures include file and directory permissions.\n\n"
  1110. # Are we in X? Display an X dialog explaining breakage.
  1111. if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
  1112. printf "%b" "$MESSAGE" | xmessage -center -file - -buttons OK > /dev/null 2>/dev/null
  1113. else
  1114. Message_Prefix
  1115. printf "%b" "$MESSAGE"
  1116. fi
  1117. fi
  1118. unset USER_DIR
  1119. unset PROFILE_DIR
  1120. unset R14_UPDATED
  1121. unset R14_VERSION
  1122. unset R14_UPDATE_TEST1
  1123. unset R14_UPDATE_TEST2
  1124. unset R14_UPDATE_TEST3
  1125. unset R14_UPDATE_TEST4
  1126. unset R14_UPDATE_TEST5
  1127. unset R14_UPDATE_TEST6
  1128. unset R14_UPDATE_TEST7
  1129. unset R14_UPDATE_TEST8
  1130. unset R14_UPDATE_TEST9
  1131. unset R14_UPDATE_TEST10
  1132. unset KDEGLOBALS_KEY_VALUE
  1133. unset TEST_NUM
  1134. unset SCRIPT_NAME
  1135. unset SCRIPT_VERSION
  1136. unset CUSTOM_MENU
  1137. exit 0