Browse Source

Added irc:// handler support to Linux installers

Linux scripts now use kdialog/zenity where appropriate to show error messages. No longer expect users to have a terminal open


git-svn-id: http://svn.dmdirc.com/trunk@2763 00569f92-eb28-0410-84fd-f71c24880f
tags/0.5.5
Shane Mc Cormack 16 years ago
parent
commit
976b44b047

+ 31
- 12
installer/linux/makeInstallerLinux.sh View File

273
 
273
 
274
 ###ADDITIONAL_STUFF###
274
 ###ADDITIONAL_STUFF###
275
 
275
 
276
+errordialog() {
277
+	# Send message to console.
278
+	echo ""
279
+	echo "-----------------------------------------------------------------------"
280
+	echo "Error: ${1}"
281
+	echo "-----------------------------------------------------------------------"
282
+	echo "${2}"
283
+	echo "-----------------------------------------------------------------------"
284
+
285
+	# Now try to use the GUI Dialogs.
286
+	ISKDE=`pidof -x -s kdeinit`
287
+	KDIALOG=`which kdialog`
288
+	ISGNOME=`pidof -x -s gnome-panel`
289
+	ZENITY=`which zenity`
290
+	if [ "" != "${ISKDE}" -a "" != "${KDIALOG}" -a "" != "${DISPLAY}" ]; then
291
+		echo "Dialog on Display: ${DISPLAY}"
292
+		${KDIALOG} --title "DMDirc: ${1}" --error "${1}\n\n${2}"
293
+	elif [ "" != "${ISGNOME}" -a "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
294
+		echo "Dialog on Display: ${DISPLAY}"
295
+		${ZENITY} --error --title "DMDirc: ${1}" --text "${1}\n\n${2}"
296
+	fi
297
+}
298
+
276
 # Location of .run stub end
299
 # Location of .run stub end
277
 ENDLINE=`grep -na "^###END INCLUDE###$" $0`
300
 ENDLINE=`grep -na "^###END INCLUDE###$" $0`
278
 ENDLINE=$((${ENDLINE%%:*} + 1))
301
 ENDLINE=$((${ENDLINE%%:*} + 1))
279
 
302
 
280
 if [ "" = "${ENDLINE}" ]; then
303
 if [ "" = "${ENDLINE}" ]; then
281
-	echo "End of stub not found. Aborting.";
304
+	errordialog "DMDirc Setup" "End of stub not found. Aborting.";
282
 	exit 0;
305
 	exit 0;
283
 fi
306
 fi
284
 
307
 
330
 				DIR=${BASEDIR}${RND}
353
 				DIR=${BASEDIR}${RND}
331
 				if [ -e "${DIR}" ]; then
354
 				if [ -e "${DIR}" ]; then
332
 					# Lets hope this never happens.
355
 					# Lets hope this never happens.
333
-					echo "Unable to create random directory";
356
+					errordialog "DMDirc Setup" "Unable to create random directory";
334
 					exit 0;
357
 					exit 0;
335
 				fi;
358
 				fi;
336
 			fi;
359
 			fi;
410
 			if [ $? = 0 ]; then
433
 			if [ $? = 0 ]; then
411
 				echo "MD5 Check Passed!"
434
 				echo "MD5 Check Passed!"
412
 			else
435
 			else
413
-				echo ""
414
-				echo "MD5 Check Failed!"
415
-				echo "--------------------------"
416
-				echo "This copy of the DMDirc installer appears to be damaged and will now exit.";
417
-				echo "You may choose to skip this check and run it anyway by passing the --nomd5 parameter";
436
+				ERROR="This copy of the DMDirc installer appears to be damaged and will now exit.";
437
+				ERROR=${ERROR}"\nYou may choose to skip this check and run it anyway by passing the --nomd5 parameter";
438
+				errordialog "DMDirc Setup: MD5 Check Failed!" "${ERROR}";
418
 				exit 1;
439
 				exit 1;
419
 			fi
440
 			fi
420
 		elif [ "${MD5}" != ""  ]; then
441
 		elif [ "${MD5}" != ""  ]; then
428
 				if [ "${MD5SUM}" = "${MD5}" ]; then
449
 				if [ "${MD5SUM}" = "${MD5}" ]; then
429
 					echo "MD5 Check Passed!"
450
 					echo "MD5 Check Passed!"
430
 				else
451
 				else
431
-					echo ""
432
-					echo "MD5 Check Failed!"
433
-					echo "--------------------------"
434
-					echo "This copy of the DMDirc installer appears to be damaged and will now exit.";
435
-					echo "You may choose to skip this check and run it anyway by passing the --nomd5 parameter";
452
+					ERROR="This copy of the DMDirc installer appears to be damaged and will now exit.";
453
+					ERROR=${ERROR}"\nYou may choose to skip this check and run it anyway by passing the --nomd5 parameter";
454
+					errordialog "DMDirc Setup: MD5 Check Failed!" "${ERROR}";
436
 					exit 1;
455
 					exit 1;
437
 				fi;
456
 				fi;
438
 			else
457
 			else

+ 35
- 20
installer/linux/setup.sh View File

23
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
 # SOFTWARE.
24
 # SOFTWARE.
25
 
25
 
26
+errordialog() {
27
+	# Send message to console.
28
+	echo ""
29
+	echo "-----------------------------------------------------------------------"
30
+	echo "Error: ${1}"
31
+	echo "-----------------------------------------------------------------------"
32
+	echo "${2}"
33
+	echo "-----------------------------------------------------------------------"
34
+
35
+	# Now try to use the GUI Dialogs.
36
+	ISKDE=`pidof -x -s kdeinit`
37
+	KDIALOG=`which kdialog`
38
+	ISGNOME=`pidof -x -s gnome-panel`
39
+	ZENITY=`which zenity`
40
+	if [ "" != "${ISKDE}" -a "" != "${KDIALOG}" -a "" != "${DISPLAY}" ]; then
41
+		echo "Dialog on Display: ${DISPLAY}"
42
+		${KDIALOG} --title "DMDirc: ${1}" --error "${1}\n\n${2}"
43
+	elif [ "" != "${ISGNOME}" -a "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
44
+		echo "Dialog on Display: ${DISPLAY}"
45
+		${ZENITY} --error --title "DMDirc: ${1}" --text "${1}\n\n${2}"
46
+	fi
47
+}
48
+
26
 echo ""
49
 echo ""
27
 echo "---------------------"
50
 echo "---------------------"
28
 echo "Setup.sh"
51
 echo "Setup.sh"
35
 else
58
 else
36
 	echo "Failed!"
59
 	echo "Failed!"
37
 	# This should in future offer to download and install the JVM automatically.
60
 	# This should in future offer to download and install the JVM automatically.
38
-	echo ""
39
-	echo "-----------------------------------------------------------------------"
40
-	echo "Unable to complete setup!"
41
-	echo "-----------------------------------------------------------------------"
42
-	echo "Sorry, java is not installed on this machine."
43
-	echo ""
44
-	echo "DMDirc requires a 1.6.0 compatible JVM, you can get one from:"
45
-	echo "http://jdl.sun.com/webapps/getjava/BrowserRedirect"
46
-	echo "-----------------------------------------------------------------------"
61
+	ERROR="Sorry, java is not installed on this machine.";
62
+	ERROR=${ERROR}"\n"
63
+	ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM, you can get one from:";
64
+	ERROR=${ERROR}"\nhttp://jdl.sun.com/webapps/getjava/BrowserRedirect";
65
+	errordialog "Unable to complete setup!" "${ERROR}";
47
 	exit 1;
66
 	exit 1;
48
 fi
67
 fi
49
 
68
 
102
 		echo "Running installer.."
121
 		echo "Running installer.."
103
 		${JAVA} -cp DMDirc.jar -jar installer.jar ${isRoot}${isRelease}
122
 		${JAVA} -cp DMDirc.jar -jar installer.jar ${isRoot}${isRelease}
104
 		if [ $? -ne 0 ]; then
123
 		if [ $? -ne 0 ]; then
105
-			echo ""
106
-			echo "-----------------------------------------------------------------------"
107
-			echo "Unable to complete setup!"
108
-			echo "-----------------------------------------------------------------------"
109
-			echo "Sorry, the currently installed version of java is not compatible with"
110
-			echo "DMDirc."
111
-			echo ""
112
-			echo "DMDirc requires a 1.6.0 compatible JVM, you can get one from:"
113
-			echo "http://jdl.sun.com/webapps/getjava/BrowserRedirect"
114
-			echo "-----------------------------------------------------------------------"
124
+			ERROR="Sorry, the currently installed version of java is not compatible with";
125
+			ERROR=${ERROR}"\nDMDirc.";
126
+			ERROR=${ERROR}"\n";
127
+			ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM, you can get one from:";
128
+			ERROR=${ERROR}"\nhttp://jdl.sun.com/webapps/getjava/BrowserRedirect";
129
+			errordialog "Unable to complete setup!" "${ERROR}";
115
 			exit 1;
130
 			exit 1;
116
 		fi
131
 		fi
117
 		exit 0;
132
 		exit 0;
118
 	fi
133
 	fi
119
-else 
134
+else
120
 	echo "No installer found!"
135
 	echo "No installer found!"
121
 fi
136
 fi
122
 
137
 

+ 36
- 20
launcher/linux/DMDirc.sh View File

37
 	shift
37
 	shift
38
 done
38
 done
39
 
39
 
40
+errordialog() {
41
+	# Send message to console.
42
+	echo ""
43
+	echo "-----------------------------------------------------------------------"
44
+	echo "Error: ${1}"
45
+	echo "-----------------------------------------------------------------------"
46
+	echo "${2}"
47
+	echo "-----------------------------------------------------------------------"
48
+
49
+	# Now try to use the GUI Dialogs.
50
+	ISKDE=`pidof -x -s kdeinit`
51
+	KDIALOG=`which kdialog`
52
+	ISGNOME=`pidof -x -s gnome-panel`
53
+	ZENITY=`which zenity`
54
+	if [ "" != "${ISKDE}" -a "" != "${KDIALOG}" -a "" != "${DISPLAY}" ]; then
55
+		echo "Dialog on Display: ${DISPLAY}"
56
+		${KDIALOG} --title "DMDirc: ${1}" --error "${1}\n\n${2}"
57
+	elif [ "" != "${ISGNOME}" -a "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
58
+		echo "Dialog on Display: ${DISPLAY}"
59
+		${ZENITY} --error --title "DMDirc: ${1}" --text "${1}\n\n${2}"
60
+	fi
61
+}
62
+
40
 jar=`dirname $0`/DMDirc.jar
63
 jar=`dirname $0`/DMDirc.jar
41
 
64
 
42
 echo "---------------------"
65
 echo "---------------------"
65
 else
88
 else
66
 	echo "Failed!"
89
 	echo "Failed!"
67
 	# This should in future offer to download and install the JVM automatically.
90
 	# This should in future offer to download and install the JVM automatically.
68
-	echo ""
69
-	echo "-----------------------------------------------------------------------"
70
-	echo "Unable to launch dmdirc!"
71
-	echo "-----------------------------------------------------------------------"
72
-	echo "Sorry, java is not installed on this machine."
73
-	echo ""
74
-	echo "DMDirc requires a 1.6.0 compatible JVM, you can get one from:"
75
-	echo "http://jdl.sun.com/webapps/getjava/BrowserRedirect"
76
-	echo "-----------------------------------------------------------------------"
91
+	ERROR="Sorry, java is not installed on this machine.";
92
+	ERROR=${ERROR}"\n"
93
+	ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM, you can get one from:";
94
+	ERROR=${ERROR}"\nhttp://jdl.sun.com/webapps/getjava/BrowserRedirect";
95
+	errordialog "Unable to launch dmdirc!" "${ERROR}";
77
 	exit 1;
96
 	exit 1;
78
 fi
97
 fi
79
 
98
 
85
 	${JAVA} -jar ${jar} --help >/dev/null 2>&1
104
 	${JAVA} -jar ${jar} --help >/dev/null 2>&1
86
 	if [ $? -ne 0 ]; then
105
 	if [ $? -ne 0 ]; then
87
 		echo "Failed."
106
 		echo "Failed."
88
-		echo ""
89
-		echo "-----------------------------------------------------------------------"
90
-		echo "Unable to launch DMDirc!"
91
-		echo "-----------------------------------------------------------------------"
92
-		echo "Sorry, the currently installed version of java is not compatible with"
93
-		echo "DMDirc."
94
-		echo ""
95
-		echo "DMDirc requires a 1.6.0 compatible JVM, you can get one from:"
96
-		echo "http://jdl.sun.com/webapps/getjava/BrowserRedirect"
97
-		echo "-----------------------------------------------------------------------"
107
+		ERROR="Sorry, the currently installed version of java is not compatible with";
108
+		ERROR=${ERROR}"\nDMDirc.";
109
+		ERROR=${ERROR}"\n";
110
+		ERROR=${ERROR}"\nDMDirc requires a 1.6.0 compatible JVM, you can get one from:";
111
+		ERROR=${ERROR}"\nhttp://jdl.sun.com/webapps/getjava/BrowserRedirect";
112
+		errordialog "Unable to launch dmdirc!" "${ERROR}";
98
 		exit 1;
113
 		exit 1;
99
 	fi
114
 	fi
100
 	
115
 	
103
 	${JAVA} -jar ${jar} ${params}
118
 	${JAVA} -jar ${jar} ${params}
104
 	exit $?;
119
 	exit $?;
105
 else 
120
 else 
106
-	echo "Failed: No jar file found!"
121
+	echo "Failed.";
122
+	errordialog "Unable to launch dmdirc!" "No jar file found";
107
 fi
123
 fi

+ 8
- 0
src/com/dmdirc/installer/Installer.java View File

146
 			throw new IOException(srcFile+" does not exist.");
146
 			throw new IOException(srcFile+" does not exist.");
147
 		}
147
 		}
148
 	}
148
 	}
149
+	
150
+	
151
+	/**
152
+	 * Any post-install tasks should be done here.
153
+	 *
154
+	 * @param location Location where app was installed to.
155
+	 */
156
+	public void postInstall(final String location) { }
149
 }
157
 }

+ 140
- 5
src/com/dmdirc/installer/LinuxInstaller.java View File

69
 			case DESKTOP:
69
 			case DESKTOP:
70
 				// No desktop for root
70
 				// No desktop for root
71
 				return !isRoot();
71
 				return !isRoot();
72
+			case PROTOCOL:
72
 			case UNINSTALLER:
73
 			case UNINSTALLER:
73
 			case MENU:
74
 			case MENU:
74
-				// Both root and non-root have a menu and uninstaller
75
+				// Both root and non-root have a menu, uninstaller, and protocol
75
 				return true;
76
 				return true;
76
 			default:
77
 			default:
77
 				// Anything else that gets added should be false until the relevent
78
 				// Anything else that gets added should be false until the relevent
94
 		
95
 		
95
 		PrintWriter writer = null;
96
 		PrintWriter writer = null;
96
 		try {
97
 		try {
97
-			String filename;
98
+			String filename = "";
99
+			String command = "";
98
 
100
 
99
 			switch (shortcutType) {
101
 			switch (shortcutType) {
100
 				case DESKTOP:
102
 				case DESKTOP:
102
 					break;
104
 					break;
103
 					
105
 					
104
 				case MENU:
106
 				case MENU:
105
-					if (CLIParser.getCLIParser().getParamNumber("-isroot") > 0) {
107
+					if (isRoot()) {
106
 						filename = "/usr/share/applications/DMDirc.desktop";
108
 						filename = "/usr/share/applications/DMDirc.desktop";
107
 					} else {
109
 					} else {
108
 						filename = System.getProperty("user.home")+"/.local/share/applications/DMDirc.desktop";
110
 						filename = System.getProperty("user.home")+"/.local/share/applications/DMDirc.desktop";
112
 				case UNINSTALLER:
114
 				case UNINSTALLER:
113
 					writer = new PrintWriter(location+"/uninstall.sh");
115
 					writer = new PrintWriter(location+"/uninstall.sh");
114
 					writer.println("#!/bin/sh");
116
 					writer.println("#!/bin/sh");
117
+					writer.println("# DMDirc Uninstaller");
118
+					writer.println("ISKDE=`pidof -x -s kdeinit`");
119
+					writer.println("KDIALOG=`which kdialog`");
120
+					writer.println("ISGNOME=`pidof -x -s gnome-panel`");
121
+					writer.println("ZENITY=`which zenity`");
122
+					writer.println("DIALOG=`which dialog`");
123
+					
124
+					if (isRoot()) {
125
+						writer.println("USER=`whoami`");
126
+						writer.println("if [ \"${USER}\" != \"root\" ]; then");
127
+						writer.println("if [ ${result} -eq 1 ]; then");
128
+						writer.println("\t\tif [ \"\" != \"${ISKDE}\" -a \"\" != \"${KDIALOG}\" -a \"\" != \"${DISPLAY}\" ]; then");
129
+						writer.println("\t\t	${KDIALOG} --title \"DMDirc Uninstaller\" --error \"Uninstall Aborted. Only root can use this script\"");
130
+						writer.println("\t\telif [ \"\" != \"${ISGNOME}\" -a \"\" != \"${ZENITY}\" -a \"\" != \"${DISPLAY}\" ]; then");
131
+						writer.println("\t\t	${ZENITY} --info --title \"DMDirc Uninstaller\" --text \"Uninstall Aborted. Only root can use this script\"");
132
+						writer.println("\t\tfi");
133
+						writer.println("\t\techo \"Uninstall Aborted. Only root can use this script\"");
134
+						writer.println("\tfi");
135
+						writer.println("exit 1;");
136
+						writer.println("fi");
137
+					}
138
+					
139
+					writer.println("if [ \"\" != \"${ISKDE}\" -a \"\" != \"${KDIALOG}\" -a \"\" != \"${DISPLAY}\" ]; then");
140
+					writer.println("	echo \"Dialog Prompt on: ${DISPLAY}\"");
141
+					writer.println("	${KDIALOG} --title \"DMDirc Uninstaller\" --yesno \"Are you sure you want to uninstall DMDirc?\"");
142
+					writer.println("elif [ \"\" != \"${ISGNOME}\" -a \"\" != \"${ZENITY}\" -a \"\" != \"${DISPLAY}\" ]; then");
143
+					writer.println("	echo \"Dialog Prompt on: ${DISPLAY}\"");
144
+					writer.println("	${ZENITY} --question --title \"DMDirc Uninstaller\" --text \"Are you sure you want to uninstall DMDirc?\"");
145
+					writer.println("elif [ \"\" != \"${DIALOG}\" ]; then");
146
+					writer.println("	${DIALOG} --title \"DMDirc Uninstaller\" --yesno \"Are you sure you want to uninstall DMDirc?\" 8 40");
147
+					writer.println("fi");
148
+					
149
+					writer.println("if [ $? -ne 0 ]; then");
150
+					writer.println("\tif [ \"\" != \"${ISKDE}\" -a \"\" != \"${KDIALOG}\" -a \"\" != \"${DISPLAY}\" ]; then");
151
+					writer.println("\t	${KDIALOG} --title \"DMDirc Uninstaller\" --msgbox \"Uninstall Aborted\"");
152
+					writer.println("\telif [ \"\" != \"${ISGNOME}\" -a \"\" != \"${ZENITY}\" -a \"\" != \"${DISPLAY}\" ]; then");
153
+					writer.println("\t	${ZENITY} --info --title \"DMDirc Uninstaller\" --text \"Uninstall Aborted\"");
154
+					writer.println("\tfi");
155
+					writer.println("\techo \"Uninstall Aborted\"");
156
+					writer.println("\texit 1;");
157
+					writer.println("fi");
158
+					
115
 					writer.println("echo \"Uninstalling dmdirc\"");
159
 					writer.println("echo \"Uninstalling dmdirc\"");
116
 					writer.println("echo \"Removing Shortcuts..\"");
160
 					writer.println("echo \"Removing Shortcuts..\"");
117
-					if (CLIParser.getCLIParser().getParamNumber("-isroot") > 0) {
161
+					if (isRoot()) {
162
+						command = "${TOOL} --config-source=`${TOOL} --get-default-source`";
163
+						filename = "/usr/share/services/irc.protocol";
118
 						writer.println("rm -Rfv /usr/share/applications/DMDirc.desktop");
164
 						writer.println("rm -Rfv /usr/share/applications/DMDirc.desktop");
119
 					} else {
165
 					} else {
166
+						command = "${TOOL}";
167
+						filename = "~/.kde/share/services/irc.protocol";
120
 						writer.println("rm -Rfv "+System.getProperty("user.home")+"/.local/share/applications/DMDirc.desktop");
168
 						writer.println("rm -Rfv "+System.getProperty("user.home")+"/.local/share/applications/DMDirc.desktop");
121
 						writer.println("rm -Rfv "+System.getProperty("user.home")+"/Desktop/DMDirc.desktop");
169
 						writer.println("rm -Rfv "+System.getProperty("user.home")+"/Desktop/DMDirc.desktop");
122
 					}
170
 					}
171
+					writer.println("TOOL=`which gconftool-2`");
172
+					writer.println("if [ \"${TOOL}\" != \"\" ]; then");
173
+					writer.println("\tCURRENT=`"+command+" --get /desktop/gnome/url-handlers/irc/command`");
174
+					writer.println("\tif [ \"${CURRENT}\" = \"\\\""+location+"/DMDirc.sh\\\" -c %s\" ]; then");
175
+					writer.println("\t\techo \"Removing Gnome Protocol Handler\"");
176
+					writer.println("\t\t"+command+" --unset /desktop/gnome/url-handlers/irc/enabled");
177
+					writer.println("\t\t"+command+" --unset /desktop/gnome/url-handlers/irc/command");
178
+					writer.println("\telse");
179
+					writer.println("\t\techo \"Not Removing Gnome Protocol Handler\"");
180
+					writer.println("\tfi");
181
+					writer.println("fi");
182
+					
183
+					writer.println("if [ -e \""+filename+"\" ]; then");
184
+					writer.println("\tCURRENT=`grep DMDirc "+filename+"`");
185
+					writer.println("\tif [ \"\" != \"${CURRENT}\" ]; then");
186
+					writer.println("\t\techo \"Removing KDE Protocol Handler\"");
187
+					writer.println("\t\trm -Rfv "+filename);
188
+					writer.println("\telse");
189
+					writer.println("\t\techo \"Not Removing KDE Protocol Handler\"");
190
+					writer.println("\tfi");
191
+					writer.println("fi");
192
+					
123
 					writer.println("echo \"Removing Installation Directory\"");
193
 					writer.println("echo \"Removing Installation Directory\"");
124
-					writer.println("rm -Rfv "+location);
194
+					writer.println("rm -Rfv \""+location+"\"");
195
+
196
+					writer.println("if [ \"\" != \"${ISKDE}\" -a \"\" != \"${KDIALOG}\" -a \"\" != \"${DISPLAY}\" ]; then");
197
+					writer.println("	${KDIALOG} --title \"DMDirc Uninstaller\" --msgbox \"DMDirc Uninstalled Successfully\"");
198
+					writer.println("elif [ \"\" != \"${ISGNOME}\" -a \"\" != \"${ZENITY}\" -a \"\" != \"${DISPLAY}\" ]; then");
199
+					writer.println("	${ZENITY} --info --title \"DMDirc Uninstaller\" --text \"DMDirc Uninstalled Successfully\"");
200
+					writer.println("fi");
201
+					
125
 					writer.println("echo \"Done.\"");
202
 					writer.println("echo \"Done.\"");
126
 					
203
 					
127
 					(new File(location+"/uninstall.sh")).setExecutable(true);
204
 					(new File(location+"/uninstall.sh")).setExecutable(true);
128
 					return;
205
 					return;
206
+				
207
+				case PROTOCOL:
208
+					if (isRoot()) {
209
+						command = "${TOOL} --config-source=`${TOOL} --get-default-source`";
210
+						filename = "/usr/share/services/";
211
+					} else {
212
+						command = "${TOOL}";
213
+						filename = "~/.kde/share/services/";
214
+					}
215
+					
216
+					writer = new PrintWriter(location+"/protocolHandlers.sh");
217
+					writer.println("#!/bin/sh");
218
+					writer.println("TOOL=`which gconftool-2`");
219
+					writer.println("if [ \"${TOOL}\" != \"\" ]; then");
220
+					writer.println("\t"+command+" --set --type=bool /desktop/gnome/url-handlers/irc/enabled true");
221
+					writer.println("\t"+command+" --set --type=string /desktop/gnome/url-handlers/irc/command \"\\\""+location+"/DMDirc.sh\\\" -c %s\"");
222
+					writer.println("fi");
223
+					writer.println("exit 0;");
224
+					writer.close();
225
+					
226
+					(new File(location+"/protocolHandlers.sh")).setExecutable(true);
227
+					
228
+					try {
229
+						final Process gconfProcess = Runtime.getRuntime().exec(new String[]{"/bin/sh", location+"/protocolHandlers.sh"});
230
+						new StreamReader(gconfProcess.getInputStream()).start();
231
+						new StreamReader(gconfProcess.getErrorStream()).start();
232
+						gconfProcess.waitFor();
233
+						(new File(location+"/protocolHandlers.sh")).delete();
234
+					} catch (Exception e) {
235
+						step.addText(" - Error adding gnome Protocol Handler: "+e.getMessage());
236
+					}
237
+					
238
+					if (filename != "") {
239
+						if ((new File(filename)).exists()) {
240
+							writer = new PrintWriter(filename+"irc.protocol");
241
+							writer.println("[Protocol]");
242
+							writer.println("Exec="+location+"/DMDirc.sh -c %u");
243
+							writer.println("protocol=irc");
244
+							writer.println("input=none");
245
+							writer.println("output=none");
246
+							writer.println("helper=true");
247
+							writer.println("listing=false");
248
+							writer.println("reading=false");
249
+							writer.println("writing=false");
250
+							writer.println("makedir=false");
251
+							writer.println("deleting=false");
252
+						}
253
+					}
254
+					return;
129
 					
255
 					
130
 				default:
256
 				default:
131
 					step.addText(" - Error creating shortcut. Not applicable to this Operating System");
257
 					step.addText(" - Error creating shortcut. Not applicable to this Operating System");
168
 		writer.println("TerminalOptions=");
294
 		writer.println("TerminalOptions=");
169
 		writer.println("Type=Application");
295
 		writer.println("Type=Application");
170
 	}
296
 	}
297
+	
298
+	/**
299
+	 * Any post-install tasks should be done here.
300
+	 *
301
+	 * @param location Location where app was installed to.
302
+	 */
303
+	public void postInstall(final String location) {
304
+		(new File(location+"/DMDirc.sh")).setExecutable(true);
305
+	}
171
 }
306
 }

+ 2
- 0
src/com/dmdirc/installer/StepInstall.java View File

137
 			}
137
 			}
138
 		}
138
 		}
139
 		
139
 		
140
+		myInstaller.postInstall(location);
141
+		
140
 		addText("");
142
 		addText("");
141
 		addText("Installation finished\n");
143
 		addText("Installation finished\n");
142
 		Main.getWizardDialog().enableNextStep(true);
144
 		Main.getWizardDialog().enableNextStep(true);

Loading…
Cancel
Save