Browse Source

Fix up symlinked TDE directory handling in upgrade scripts

Automatically run migratekde3 for symlinked directories if user breaks symlink
This relates to Bug 2202
tags/r14.0.0
Darrell Anderson 4 years ago
parent
commit
84987892db
2 changed files with 21 additions and 20 deletions
  1. 10
    10
      migratekde3
  2. 11
    10
      r14-xdg-update

+ 10
- 10
migratekde3 View File

@@ -130,6 +130,16 @@ else
130 130
 fi
131 131
 unset BIN_DIR
132 132
 
133
+# Trap when the user runs this script while in a Trinity session.
134
+# Most files can be updated "live" but some can't, such as kdeglobals.
135
+if [ "$TDE_FULL_SESSION" != "" ] && [ "$TDE_SESSION_UID" != "" ] && [ "`ps ax | grep \`tail -n1 $HOME/.DCOPserver_\`uname -n\`__0 2>/dev/null\` | grep -v grep`" != "" ]; then
136
+  MESSAGE="You are running this script while a Trinity session is active.\nMost files can be updated \"live\" but some cannot, such as kdeglobals.\n\nThis script probably will not complete successfully. :-)"
137
+  # Are we in X? Display an X dialog explaining breakage.
138
+  printf "%b" "$MESSAGE\n"
139
+  Wait_For_Response "Continue?"
140
+  Proceed_From_Response
141
+fi
142
+
133 143
 echo
134 144
 echo "This script migrates an existing KDE3 profile directory."
135 145
 echo "The definition of a KDE3 profile directory includes some"
@@ -172,16 +182,6 @@ if [ "$TDEHOME_LINK" != "" ]; then
172 182
   fi
173 183
 fi
174 184
 
175
-# Trap when the user runs this script while in a Trinity session.
176
-# Most files can be updated "live" but some can't, such as kdeglobals.
177
-if [ "$TDE_FULL_SESSION" != "" ] || [ "$TDE_SESSION_UID" != "" ] || [ -f $HOME/.DCOPserver_`uname -n`__* ]; then
178
-  MESSAGE="You are running this script while a Trinity session is active.\nMost files can be updated \"live\" but some cannot, such as kdeglobals.\n\nThis script might complete successfully and might not. Probably not. :-)"
179
-  # Are we in X? Display an X dialog explaining breakage.
180
-  printf "%b" "$MESSAGE\n"
181
-  Wait_For_Response "Continue?"
182
-  Proceed_From_Response
183
-fi
184
-
185 185
 if [ -d "$HOME/.trinity" ] && [ "$BACKUP" = "true" ]; then
186 186
   echo "$HOME/.trinity already exists." 1>&2
187 187
   echo "User requested a backup copy."

+ 11
- 10
r14-xdg-update View File

@@ -3,7 +3,7 @@
3 3
 # A script to perform R14.0.0 XDG compliance updates.
4 4
 
5 5
 SCRIPT_NAME="`basename \`readlink -f $0\``"
6
-SCRIPT_VERSION=201410170
6
+SCRIPT_VERSION=201411240
7 7
 
8 8
 # This script should be needed to run only once, but corner cases
9 9
 # and file/directory permissions could cause incomplete updates.
@@ -91,7 +91,7 @@ fi
91 91
 
92 92
 unset KDEGLOBALS_KEY_VALUE
93 93
 
94
-WARNING_MESSAGE="Trinity R14 XDG compliance updates will not be performed.\n\nWithout R14 XDG compliance updates, some Trinity apps will fail to\nfunction properly.\n\nFailures include the following:\n\n* Many left-side icon lists will not populate,\n  such as the Panel and Konqueror configuration dialogs.\n\n* User-defined keyboard shortcuts fail (khotkeysrc).\n  System defined shortcuts remain functional.\n\n* User-defined app preferences fail (profilerc).\n\n* Konqueror navigation/sidebar panel won't open.\n\n* User-defined konqueror service menus, kicker customization,\n* konqueror sidebar, Recent Documents list fail.\n\nPlease exercise appropriate action.\n"
94
+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"
95 95
 
96 96
 # As the user should not be logged into a Trinity session when running
97 97
 # this script, or an administrator might run this script remotely, the
@@ -175,14 +175,14 @@ if [ "$TDEHOME_LINK" != "" ]; then
175 175
   if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
176 176
     echo "[r14-xdg-update] Warning! The profile directory $PROFILE_DIR is a" 1>&2
177 177
     echo "                 sym link to $TDEHOME_LINK!" 1>&2
178
-    echo "                 R14 updates will not be performed because Trinity needs its own" 1>&2
178
+    echo "                 R14 updates will not continue because Trinity needs its own" 1>&2
179 179
     echo "                 separate profile directory." 1>&2
180 180
     echo "                 Without R14 updates some Trinity apps will fail to function correctly." 1>&2
181 181
   fi
182
-  MESSAGE="Oops! The profile directory $PROFILE_DIR is a sym link to $TDEHOME_LINK.\n\n${WARNING_MESSAGE}\nPossible remedies:\n\n* Contact your system administrator.\n\n* Break the sym link to force creating a fresh Trinity profile.\n\n* Use the migratekde3 script to migrate a KDE3 profile to Trinity."
182
+  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."
183 183
   # Are we in X? Display an X dialog explaining breakage.
184 184
   if [ "$USER_DIR" = "$HOME" ] && [ "$DISPLAY" != "" ]; then
185
-    MESSAGE="${MESSAGE}\n\nSelecting the Continue button means retaining the KDE3 profile and\nbreaking the sym link. With the sym link broken, run the migratekde3\nscript before restarting Trinity to migrate a KDE3 profile or\nallow Trinity to create a fresh profile."
185
+    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."
186 186
     printf "%b" "$MESSAGE" | xmessage -center -file - -buttons Continue,Quit > /dev/null 2>/dev/null
187 187
     EXIT_CODE="$?"
188 188
     unset TDEHOME_LINK
@@ -193,7 +193,7 @@ if [ "$TDEHOME_LINK" != "" ]; then
193 193
       exit 1
194 194
     else
195 195
       # User selected the Continue button: continue this script and start TDE.
196
-      Log "The user chose to continue, which will break the sym link."
196
+      Log "The user chose to continue to break the sym link."
197 197
       BREAK_SYMLINK="true"
198 198
     fi
199 199
   else
@@ -207,20 +207,21 @@ if [ "$TDEHOME_LINK" != "" ]; then
207 207
   if [ "$BREAK_SYMLINK" = "true" ]; then
208 208
     unlink "$USER_DIR/.trinity" 2>/dev/null
209 209
     if [ "`readlink \"$USER_DIR/.trinity\"`" = "" ]; then
210
-      MESSAGE="Sym link broken. With the sym link broken, run the migratekde3\nscript before restarting Trinity to migrate a KDE3 profile or\nallow Trinity to create a fresh profile."
210
+      MESSAGE="Sym link broken. With the sym link broken, will now attempt\nto migrate the KDE3 profile."
211 211
       Message_Prefix
212 212
       printf "%b" "$MESSAGE"
213 213
       echo
214
+      ${TDEDIR}/bin/migratekde3
214 215
     else
215 216
       MESSAGE="Unable to break the sym link. Check file and directory privileges. Quitting."
216 217
       Message_Prefix
217 218
       echo "$MESSAGE"
218 219
       echo
220
+      unset PROFILE_DIR
221
+      unset TDEHOME_LINK
222
+      exit 1
219 223
     fi
220 224
   fi
221
-  unset PROFILE_DIR
222
-  unset TDEHOME_LINK
223
-  exit 1
224 225
 fi
225 226
 unset TDEHOME_LINK
226 227
 

Loading…
Cancel
Save