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.

r14-xdg-update 55KB

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