Browse Source

Lotsa changes to the linux installer to make it also run on OpenSolaris (and possibly normal solaris aswell, I don't have gui access to a normal solaris machine from here will try when I go back to uni)


git-svn-id: http://svn.dmdirc.com/trunk@4225 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Shane Mc Cormack 16 years ago
parent
commit
3386666e1a

+ 52
- 10
installer/linux/getjre.sh View File

@@ -3,6 +3,29 @@
3 3
 # This script downloads a JRE.
4 4
 #
5 5
 
6
+# Check the which command exists, and if so make sure it behaves how we want
7
+# it to...
8
+WHICH=`which which 2>/dev/null`
9
+if [ "" = "${WHICH}" ]; then
10
+	echo "which command not found. Aborting.";
11
+	exit 0;
12
+else
13
+	# Solaris sucks
14
+	BADWHICH=`which /`
15
+	if [ "${BADWHICH}" != "" ]; then
16
+		echo "Replacing bad which command.";
17
+		# "Which" on solaris gives non-empty results for commands that don't exist
18
+		which() {
19
+			OUT=`${WHICH} ${1}`
20
+			if [ $? -eq 0 ]; then
21
+				echo ${OUT}
22
+			else
23
+				echo ""
24
+			fi;
25
+		}
26
+	fi;
27
+fi
28
+
6 29
 PIDOF=`which pidof`
7 30
 if [ "${PIDOF}" = "" ]; then
8 31
 	# For some reason some distros hide pidof...
@@ -18,8 +41,8 @@ if [ "${PIDOF}" != "" ]; then
18 41
 	ISKDE=`${PIDOF} -x -s kdeinit`
19 42
 	ISGNOME=`${PIDOF} -x -s gnome-panel`
20 43
 else
21
-	ISKDE=`ps ux | grep kdeinit | grep -v grep`
22
-	ISGNOME=`ps ux | grep gnome-panel | grep -v grep`
44
+	ISKDE=`ps -Af | grep kdeinit | grep -v grep`
45
+	ISGNOME=`ps -Af | grep gnome-panel | grep -v grep`
23 46
 fi;
24 47
 KDIALOG=`which kdialog`
25 48
 ZENITY=`which zenity`
@@ -83,14 +106,25 @@ questiondialog() {
83 106
 	fi
84 107
 }
85 108
 
109
+# Get the JRE.
86 110
 ARCH=`uname -m`
87
-# This page redirects us to the correct JRE
88
-URL="http://www.dmdirc.com/getjava/linux/`uname -m`"
111
+ISAINFO=`which isainfo`
112
+if [ "${ISAINFO}" != "" ]; then
113
+	# Solaris-ish
114
+	ARCH=`uname -p`
115
+fi;
116
+URL="http://www.dmdirc.com/getjava/`uname -s`/${ARCH}"
89 117
 
90 118
 length=`wget --spider ${URL} 2>&1 | grep "Length:"| awk '{print $2, $3}' | sed 's/,//g'`
91 119
 actualLength=${length%% *}
92 120
 niceLength=`echo ${length##* }  | sed 's/[()]//g'`
93 121
 
122
+if [ "${actualLength}" = "6" ]; then
123
+	# Unable to download.
124
+	errordialog "Download Failed" "Unable to find JRE for this platform (`uname -s`/${ARCH})."
125
+	exit 1;
126
+fi;
127
+
94 128
 PIPE=""
95 129
 wgetpid=""
96 130
 # Make sure wget and the progressbar die if we do.
@@ -101,7 +135,7 @@ badclose() {
101 135
 	if [ "${PIPE}" != "" ]; then
102 136
 		if [ -e ${PIPE} ]; then
103 137
 			echo "quit" > ${PIPE}
104
-			rm -Rf ${PIPE}
138
+			echo "Closing badly, pipe still exists."
105 139
 		fi
106 140
 	fi
107 141
 }
@@ -116,10 +150,11 @@ else
116 150
 fi;
117 151
 if [ $result -eq 0 ]; then
118 152
 	PIPE=`mktemp -p ${PWD} progresspipe.XXXXXXXXXXXXXX`
119
-	/bin/sh ${PWD}/progressbar.sh "Downloading JRE.." ${actualLength} ${PIPE} &
120 153
 	wget -q ${URL} -O jre.bin &
121 154
 	wgetpid=${!}
122
-	while [ `ps ${wgetpid} | wc -l` = 2 ]; do
155
+	/bin/sh ${PWD}/progressbar.sh "Downloading JRE.." ${actualLength} ${PIPE} ${wgetpid} &
156
+	progressbarpid=${!}
157
+	while [ `ps -p ${wgetpid} | wc -l` = 2 ]; do
123 158
 		SIZE=`ls -l jre.bin | awk '{print $5}'`
124 159
 		if [ -e ${PIPE} ]; then
125 160
 			echo "${SIZE}" > ${PIPE}
@@ -130,9 +165,16 @@ if [ $result -eq 0 ]; then
130 165
 		fi;
131 166
 	done;
132 167
 	wgetpid=""
133
-	echo "quit" > ${PIPE}
168
+#	echo "Killing progressbar"
169
+#	kill ${progressbarpid}
134 170
 	messagedialog "Download Completed" "Download Completed"
135
-	exit 1;
171
+	if [ -e ${PIPE} ]; then
172
+		echo "Deleting Pipe ${PIPE}"
173
+		rm -Rf "${PIPE}"
174
+	fi;
175
+	exit 0;
136 176
 else
137 177
 	messagedialog "Download JRE" "JRE Download Canceled"
138
-fi;
178
+	exit 1;
179
+fi;
180
+exit 1;

+ 69
- 9
installer/linux/installerstub.sh View File

@@ -25,13 +25,43 @@
25 25
 
26 26
 MD5=""
27 27
 
28
-# Check the which command exists
28
+# Check the which command exists, and if so make sure it behaves how we want
29
+# it to...
29 30
 WHICH=`which which 2>/dev/null`
30 31
 if [ "" = "${WHICH}" ]; then
31 32
 	echo "which command not found. Aborting.";
32 33
 	exit 0;
34
+else
35
+	# Solaris sucks
36
+	BADWHICH=`which /`
37
+	if [ "${BADWHICH}" != "" ]; then
38
+		# "Which" on solaris gives non-empty results for commands that don't exist
39
+		which() {
40
+			OUT=`${WHICH} ${1}`
41
+			if [ $? -eq 0 ]; then
42
+				echo ${OUT}
43
+			else
44
+				echo ""
45
+			fi;
46
+		}
47
+	fi;
33 48
 fi
34 49
 
50
+# Find out what params we should pass to things.
51
+# Solaris has a nice and ancient version of grep in /usr/bin
52
+grep -na "" /dev/null >/dev/null 2>&1
53
+if [ $? -eq 2 ]; then
54
+	GREPOPTS="-n"
55
+else
56
+	GREPOPTS="-na"
57
+fi;
58
+# Solaris also has a crappy version of tail!
59
+tail -n +1 /dev/null >/dev/null 2>&1
60
+if [ $? -eq 2 ]; then
61
+	TAILOPTS="+"
62
+else
63
+	TAILOPTS="-n +"
64
+fi;
35 65
 
36 66
 ###ADDITIONAL_STUFF###
37 67
 
@@ -60,8 +90,8 @@ errordialog() {
60 90
 		ISKDE=`${PIDOF} -x -s kdeinit`
61 91
 		ISGNOME=`${PIDOF} -x -s gnome-panel`
62 92
 	else
63
-		ISKDE=`ps ux | grep kdeinit | grep -v grep`
64
-		ISGNOME=`ps ux | grep gnome-panel | grep -v grep`
93
+		ISKDE=`ps -Af | grep kdeinit | grep -v grep`
94
+		ISGNOME=`ps -Af | grep gnome-panel | grep -v grep`
65 95
 	fi;
66 96
 	KDIALOG=`which kdialog`
67 97
 	ZENITY=`which zenity`
@@ -75,7 +105,7 @@ errordialog() {
75 105
 }
76 106
 
77 107
 # Location of .run stub end
78
-ENDLINE=`grep -na "^###END STUB###$" $0`
108
+ENDLINE=`grep ${GREPOPTS} "^###END STUB###$" $0`
79 109
 ENDLINE=$((${ENDLINE%%:*} + 1))
80 110
 
81 111
 if [ "" = "${ENDLINE}" ]; then
@@ -143,10 +173,40 @@ random() {
143 173
 }
144 174
 
145 175
 uncompress() {
146
-	tail -n +${ENDLINE} "${OLDPWD}/$0" | gzip -cd | tar -xvf - 2>/dev/null || {
176
+#	DEBUGINFO="\n\nRunname: ${0}"
177
+#	DEBUGINFO="${DEBUGINFO}\nOldPwd: ${OLDPWD}"
178
+
179
+	# Try runname, in old dir.
180
+	FILE=${OLDPWD}/$0
181
+	if [ ! -e ${FILE} ]; then
182
+		# Else, try run filename in old dir
183
+		FILE=${OLDPWD}/`basename $0`
184
+		if [ ! -e ${FILE} ]; then
185
+			# Else try run name
186
+			FILE=$0
187
+			if [ ! -e ${FILE} ]; then
188
+				# Unable to find this file!
189
+				errordialog "DMDirc Setup" "Unable to find installer.\nThis shouldn't happen, please raise a bug report at http://bugs.dmdirc.com${DEBUGINFO}";
190
+				echo "Removing temp dir"
191
+				cd ${OLDPWD}
192
+				rm -Rf ${TEMPDIR}
193
+				exit 1;
194
+			fi;
195
+		fi;
196
+	fi;
197
+	echo "Decompressing: ${FILE}"
198
+#	DEBUGINFO="${DEBUGINFO}\nFile: ${FILE}"
199
+#	DEBUGINFO="${DEBUGINFO}\nCommand: tail ${TAILOPTS}${ENDLINE} "${FILE}" | gzip -cd | tar -xvf - 2>/dev/null"
200
+	OUTPUT=`tail ${TAILOPTS}${ENDLINE} "${FILE}" | gzip -cd | tar -xvf - 2>/dev/null`
201
+	if [ "${OUTPUT}" = "" ]; then
147 202
 		echo "Decompression failed."
148
-		kill -15 $$;
149
-	};
203
+		errordialog "DMDirc Setup" "Decompression failed.\nThis shouldn't happen, please raise a bug report at http://bugs.dmdirc.com${DEBUGINFO}";
204
+		echo "Removing temp dir"
205
+		cd ${OLDPWD}
206
+		rm -Rf ${TEMPDIR}
207
+		exit 1;
208
+	fi;
209
+	echo "Decompression successful."
150 210
 }
151 211
 
152 212
 showHelp() {
@@ -196,10 +256,10 @@ MD5BIN=`which md5sum`
196 256
 AWK=`which awk`
197 257
 getMD5() {
198 258
 	# Everything below the MD5SUM Line
199
-	MD5LINE=`grep -na "^MD5=\".*\"$" ${1}`
259
+	MD5LINE=`grep ${GREPOPTS} "^MD5=\".*\"$" ${1}`
200 260
 	MD5LINE=$((${MD5LINE%%:*} + 1))
201 261
 
202
-	MD5SUM=`tail -n +${MD5LINE} "${1}" | ${MD5BIN} - | ${AWK} '{print $1}'`
262
+	MD5SUM=`tail ${TAILOPTS}${MD5LINE} "${1}" | ${MD5BIN} - | ${AWK} '{print $1}'`
203 263
 	return;
204 264
 }
205 265
 

+ 62
- 17
installer/linux/installjre.sh View File

@@ -3,6 +3,44 @@
3 3
 # Install the JRE.
4 4
 #
5 5
 
6
+# Find out what params we should pass to things.
7
+# Solaris has a nice and ancient version of grep in /usr/bin
8
+grep -na "" /dev/null >/dev/null 2>&1
9
+if [ $? -eq 2 ]; then
10
+	GREPOPTS="-n"
11
+else
12
+	GREPOPTS="-na"
13
+fi;
14
+# Solaris also has a crappy version of tail!
15
+tail -n +1 /dev/null >/dev/null 2>&1
16
+if [ $? -eq 2 ]; then
17
+	TAILOPTS="+"
18
+else
19
+	TAILOPTS="-n +"
20
+fi;
21
+# Check the which command exists, and if so make sure it behaves how we want
22
+# it to...
23
+WHICH=`which which 2>/dev/null`
24
+if [ "" = "${WHICH}" ]; then
25
+	echo "which command not found. Aborting.";
26
+	exit 0;
27
+else
28
+	# Solaris sucks
29
+	BADWHICH=`which /`
30
+	if [ "${BADWHICH}" != "" ]; then
31
+		echo "Replacing bad which command.";
32
+		# "Which" on solaris gives non-empty results for commands that don't exist
33
+		which() {
34
+			OUT=`${WHICH} ${1}`
35
+			if [ $? -eq 0 ]; then
36
+				echo ${OUT}
37
+			else
38
+				echo ""
39
+			fi;
40
+		}
41
+	fi;
42
+fi
43
+
6 44
 PIDOF=`which pidof`
7 45
 if [ "${PIDOF}" = "" ]; then
8 46
 	# For some reason some distros hide pidof...
@@ -18,8 +56,8 @@ if [ "${PIDOF}" != "" ]; then
18 56
 	ISKDE=`${PIDOF} -x -s kdeinit`
19 57
 	ISGNOME=`${PIDOF} -x -s gnome-panel`
20 58
 else
21
-	ISKDE=`ps ux | grep kdeinit | grep -v grep`
22
-	ISGNOME=`ps ux | grep gnome-panel | grep -v grep`
59
+	ISKDE=`ps -Af | grep kdeinit | grep -v grep`
60
+	ISGNOME=`ps -Af | grep gnome-panel | grep -v grep`
23 61
 fi;
24 62
 KDIALOG=`which kdialog`
25 63
 ZENITY=`which zenity`
@@ -89,13 +127,13 @@ showLicense() {
89 127
 	FILE=`mktemp -p ${PWD} license.XXXXXXXXXXXXXX`
90 128
 	
91 129
 	# Location of license start
92
-	STARTLINE=`grep -na "^more <<\"EOF\"$" jre.bin`
130
+	STARTLINE=`grep ${GREPOPTS} "^more <<\"EOF\"$" jre.bin`
93 131
 	STARTLINE=$((${STARTLINE%%:*} + 1))
94 132
 	# Location of license end
95
-	ENDLINE=`grep -na "Do you agree to the above license terms?" jre.bin`
133
+	ENDLINE=`grep ${GREPOPTS} "Do you agree to the above license terms?" jre.bin`
96 134
 	ENDLINE=$((${ENDLINE%%:*} - 2))
97 135
 	
98
-	head -n ${ENDLINE} jre.bin | tail -n +${STARTLINE} > ${FILE}
136
+	head -n ${ENDLINE} jre.bin | tail ${TAILOPTS}${STARTLINE} > ${FILE}
99 137
 	
100 138
 	# Send text to console.
101 139
 	echo ""
@@ -132,9 +170,11 @@ showLicense
132 170
 questiondialog "Java Install" "Do you agree to the Java License?"
133 171
 if [ $? -eq 0 ]; then
134 172
 	# Look to see where the JRE wants to install to
135
-	JREJAVAHOME=`grep -na "^javahome=" jre.bin`
173
+	JREJAVAHOME=`grep ${GREPOPTS} "^javahome=" jre.bin`
136 174
  	JREJAVAHOME=${JREJAVAHOME##*=}
137 175
 	
176
+	echo "JREJAVAHOME: ${JREJAVAHOME}"
177
+	
138 178
 	if [ "${UID}" = "" ]; then
139 179
 		UID=`id -u`;
140 180
 	fi
@@ -144,30 +184,32 @@ if [ $? -eq 0 ]; then
144 184
 		installdir=${HOME}/${JREJAVAHOME}
145 185
 	fi;
146 186
 	
147
-	if [ -e ${installdir} ]; then
187
+	echo "installdir: ${installdir}"
188
+	
189
+	if [ ! -e ${installdir} ]; then
148 190
 		# Hack jre.bin to allow us to install without asking for a license, or failing
149 191
 		# the checksum.
150 192
 		
151 193
 		# Location of license start
152
-		STARTLINE=`grep -na "^more <<\"EOF\"$" jre.bin`
194
+		STARTLINE=`grep ${GREPOPTS} "^more <<\"EOF\"$" jre.bin`
153 195
 		STARTLINE=${STARTLINE%%:*}
154 196
 		# Location of license end
155
-		ENDLINE=`grep -na "If you don't agree to the license you can't install this software" jre.bin`
197
+		ENDLINE=`grep ${GREPOPTS} "If you don't agree to the license you can't install this software" jre.bin`
156 198
 		ENDLINE=$((${ENDLINE%%:*} + 3))
157 199
 		# Location of checksum start
158
-		CSSTARTLINE=`grep -na "^if \[ -x /usr/bin/sum \]; then$" jre.bin`
200
+		CSSTARTLINE=`grep ${GREPOPTS} "^if \[ -x /usr/bin/sum \]; then$" jre.bin`
159 201
 		CSSTARTLINE=${CSSTARTLINE%%:*}
160 202
 		# Location of checksum end
161
-		CSENDLINE=`grep -na "Can't find /usr/bin/sum to do checksum" jre.bin`
203
+		CSENDLINE=`grep ${GREPOPTS} "Can't find /usr/bin/sum to do checksum" jre.bin`
162 204
 		CSENDLINE=$((${CSENDLINE%%:*} + 2))
163 205
 		# Location of script end
164
-		SCENDLINE=`grep -na "^echo \"Done.\"$" jre.bin`
206
+		SCENDLINE=`grep ${GREPOPTS} "^echo \"Done.\"$" jre.bin`
165 207
 		SCENDLINE=$((${SCENDLINE%%:*} + 2 - (${ENDLINE} - ${STARTLINE}) - (${CSENDLINE} - ${CSSTARTLINE})))
166 208
 		# Remove the license and checksum stuff!
167 209
 		head -n $((${STARTLINE} -1)) jre.bin > jre.bin.tmp
168
-		tail -n +$((${ENDLINE})) jre.bin | head -n $((${CSSTARTLINE} -1 - ${ENDLINE})) >> jre.bin.tmp
210
+		tail ${TAILOPTS}$((${ENDLINE})) jre.bin | head -n $((${CSSTARTLINE} -1 - ${ENDLINE})) >> jre.bin.tmp
169 211
 		echo "tail \${tail_args} +${SCENDLINE} \"\$0\" > \$outname" >> jre.bin.tmp
170
-		tail -n +$((${CSENDLINE})) jre.bin >> jre.bin.tmp
212
+		tail ${TAILOPTS}$((${CSENDLINE})) jre.bin >> jre.bin.tmp
171 213
 		
172 214
 		messagedialog "Java Install" "Java install will begin when you press OK.\nThis may take some time, so please wait.\n\nYou will be informed when the installation is completed."
173 215
 		yes | sh jre.bin.tmp
@@ -199,8 +241,9 @@ if [ $? -eq 0 ]; then
199 241
 				echo "endfi" >> ${HOME}/.cshrc
200 242
 			fi
201 243
 			
244
+			echo "Adding JREPath: ${PWD}/jrepath"
202 245
 			# This allows the main installer to continue with the new java version.
203
-			echo "export PATH=~/${JREJAVAHOME}/bin:\"\${PATH}\"" > .jrepath
246
+			echo "export PATH=~/${JREJAVAHOME}/bin:\"\${PATH}\"" > ${PWD}/jrepath
204 247
 			
205 248
 			# This allows dmdirc launcher to find the jre if the path is not set.
206 249
 			ln -sf ${installdir} ${HOME}/jre
@@ -209,8 +252,10 @@ if [ $? -eq 0 ]; then
209 252
 		messagedialog "Java Install" "Java installation complete"
210 253
 		exit 0;
211 254
 	else
212
-		messagedialog "Java Install" "An existing install was found at ${installdir}, but this directory is not in the current path."
213
-		echo "export PATH=~/${JREJAVAHOME}/bin:\"\${PATH}\"" > .jrepath
255
+		messagedialog "Java Install" "An existing install was found at ${installdir}, but this directory is not in the current path, DMDirc setup will try to use this version of java for the install."
256
+		echo "Adding JREPath: ${PWD}/jrepath"
257
+		# This allows the main installer to continue with the new java version.
258
+		echo "export PATH=~/${JREJAVAHOME}/bin:\"\${PATH}\"" > ${PWD}/jrepath
214 259
 		exit 0;
215 260
 	fi;
216 261
 else

+ 44
- 6
installer/linux/makeInstallerLinux.sh View File

@@ -28,6 +28,44 @@ INSTALLERNAME=DMDirc-Setup
28 28
 # full name of the file to output to
29 29
 RUNNAME="${PWD}/${INSTALLERNAME}.run"
30 30
 
31
+# Find out what params we should pass to things.
32
+# Solaris has a nice and ancient version of grep in /usr/bin
33
+grep -na "" /dev/null >/dev/null 2>&1
34
+if [ $? -eq 2 ]; then
35
+	GREPOPTS="-n"
36
+else
37
+	GREPOPTS="-na"
38
+fi;
39
+# Solaris also has a crappy version of tail!
40
+tail -n +1 /dev/null >/dev/null 2>&1
41
+if [ $? -eq 2 ]; then
42
+	TAILOPTS="+"
43
+else
44
+	TAILOPTS="-n +"
45
+fi;
46
+# Check the which command exists, and if so make sure it behaves how we want
47
+# it to...
48
+WHICH=`which which 2>/dev/null`
49
+if [ "" = "${WHICH}" ]; then
50
+	echo "which command not found. Aborting.";
51
+	exit 0;
52
+else
53
+	# Solaris sucks
54
+	BADWHICH=`which /`
55
+	if [ "${BADWHICH}" != "" ]; then
56
+		echo "Replacing bad which command.";
57
+		# "Which" on solaris gives non-empty results for commands that don't exist
58
+		which() {
59
+			OUT=`${WHICH} ${1}`
60
+			if [ $? -eq 0 ]; then
61
+				echo ${OUT}
62
+			else
63
+				echo ""
64
+			fi;
65
+		}
66
+	fi;
67
+fi
68
+
31 69
 # Compress stuff!
32 70
 compress() {
33 71
 	tar cvfh - $@ | gzip - 2>/dev/null >>${RUNNAME} || {
@@ -264,19 +302,19 @@ getMD5() {
264 302
 
265 303
 getMD5Linux() {
266 304
 	# Everything below the MD5SUM Line
267
-	MD5LINE=`grep -na "^MD5=\".*\"$" ${1}`
305
+	MD5LINE=`grep ${GREPOPTS} "^MD5=\".*\"$" ${1}`
268 306
 	MD5LINE=$((${MD5LINE%%:*} + 1))
269 307
 
270
-	MD5SUM=`tail -n +${MD5LINE} "${1}" | ${MD5BIN} - | ${AWK} '{print $1}'`
308
+	MD5SUM=`tail ${TAILOPTS}${MD5LINE} "${1}" | ${MD5BIN} - | ${AWK} '{print $1}'`
271 309
 	return;
272 310
 }
273 311
 
274 312
 getMD5OSX() {
275 313
 	# Everything below the MD5SUM Line
276
-	MD5LINE=`grep -na "^MD5=\".*\"$" ${1}`
314
+	MD5LINE=`grep ${GREPOPTS} "^MD5=\".*\"$" ${1}`
277 315
 	MD5LINE=$((${MD5LINE%%:*} + 1))
278 316
 
279
-	MD5SUM=`tail -n +${MD5LINE} "${1}" | ${MD5BIN} | ${AWK} '{print $1}'`
317
+	MD5SUM=`tail ${TAILOPTS}${MD5LINE} "${1}" | ${MD5BIN} | ${AWK} '{print $1}'`
280 318
 	return;
281 319
 }
282 320
 
@@ -288,12 +326,12 @@ if [ "${MD5BIN}" != "" -a "${AWK}" != "" ]; then
288 326
 
289 327
 	echo "SUM obtained is: ${MD5SUM}"
290 328
 
291
-	LINENUM=`grep -na "^MD5=\"\"$" ${RUNNAME}`
329
+	LINENUM=`grep ${GREPOPTS} "^MD5=\"\"$" ${RUNNAME}`
292 330
 	LINENUM=${LINENUM%%:*}
293 331
 
294 332
 	head -n $((${LINENUM} -1)) ${RUNNAME} > ${RUNNAME}.tmp
295 333
 	echo 'MD5="'${MD5SUM}'"' >> ${RUNNAME}.tmp
296
-	tail -n +$((${LINENUM} +1)) ${RUNNAME} >> ${RUNNAME}.tmp
334
+	tail ${TAILOPTS}$((${LINENUM} +1)) ${RUNNAME} >> ${RUNNAME}.tmp
297 335
 	mv ${RUNNAME}.tmp ${RUNNAME}
298 336
 else
299 337
 	echo "Not Adding MD5.."

+ 56
- 9
installer/linux/progressbar.sh View File

@@ -10,6 +10,36 @@
10 10
 # only terminate when the next line of data is read from the pipe.
11 11
 #
12 12
 
13
+# Check the which command exists, and if so make sure it behaves how we want
14
+# it to...
15
+WHICH=`which which 2>/dev/null`
16
+if [ "" = "${WHICH}" ]; then
17
+	echo "which command not found. Aborting.";
18
+	exit 0;
19
+else
20
+	# Solaris sucks
21
+	BADWHICH=`which /`
22
+	if [ "${BADWHICH}" != "" ]; then
23
+		echo "Replacing bad which command.";
24
+		# "Which" on solaris gives non-empty results for commands that don't exist
25
+		which() {
26
+			OUT=`${WHICH} ${1}`
27
+			if [ $? -eq 0 ]; then
28
+				echo ${OUT}
29
+			else
30
+				echo ""
31
+			fi;
32
+		}
33
+	fi;
34
+fi
35
+# Solaris also has a crappy version of tail!
36
+tail -n +1 /dev/null >/dev/null 2>&1
37
+if [ $? -eq 2 ]; then
38
+	TAILOPTS="-"
39
+else
40
+	TAILOPTS="-n"
41
+fi;
42
+
13 43
 PIDOF=`which pidof`
14 44
 if [ "${PIDOF}" = "" ]; then
15 45
 	# For some reason some distros hide pidof...
@@ -25,29 +55,31 @@ if [ "${PIDOF}" != "" ]; then
25 55
 	ISKDE=`${PIDOF} -x -s kdeinit`
26 56
 	ISGNOME=`${PIDOF} -x -s gnome-panel`
27 57
 else
28
-	ISKDE=`ps ux | grep kdeinit | grep -v grep`
29
-	ISGNOME=`ps ux | grep gnome-panel | grep -v grep`
58
+	ISKDE=`ps -Af | grep kdeinit | grep -v grep`
59
+	ISGNOME=`ps -Af | grep gnome-panel | grep -v grep`
30 60
 fi;
31 61
 KDIALOG=`which kdialog`
32 62
 ZENITY=`which zenity`
33 63
 CAPTION=${1}
34 64
 FILESIZE=${2}
65
+WGETPID=${3}
35 66
 progresswindow=""
36 67
 TYPE=""
37 68
 PIPE="progresspipe_${$}"
38 69
 retval="1"
70
+CONTINUE="1"
39 71
 
40 72
 readprogress() {
41 73
 	data=""
42 74
 	input=""
43
-	while [ -e ${PIPE} ]; do
75
+	while [ ${CONTINUE} -eq "1" -a -e ${PIPE} ]; do
44 76
 		if [ "${TYPE}" = "KDE" ]; then
45 77
 			if [ `dcop ${progresswindow} wasCancelled` = "true" ]; then
46 78
 				break;
47 79
 			fi
48 80
 		fi;
49
-		input=`cat "${PIPE}"`
50
-		if [ "${input}" == "quit" ]; then
81
+		input=`cat "${PIPE}" | tail ${TAILOPTS}1`
82
+		if [ "${input}" = "quit" ]; then
51 83
 			break;
52 84
 		elif [ "${input}" != "" ]; then
53 85
 			data=${input}
@@ -74,6 +106,7 @@ readprogress() {
74 106
 			fi;
75 107
 			if [ "${val}" = "100" ]; then
76 108
 				retval="0"
109
+				CONTINUE="0"
77 110
 				break;
78 111
 			fi;
79 112
 		fi;
@@ -99,14 +132,21 @@ else
99 132
 fi;
100 133
 
101 134
 echo "Using pipe: "${PIPE}
102
-
103 135
 mkfifo "${PIPE}"
104 136
 closeProgress() {
137
+	CONTINUE="0"
105 138
 	if [ "${TYPE}" = "KDE" -a ${retval} != "0" ]; then
106 139
 		dcop ${progresswindow} close
107 140
 	fi;
108
-	echo "Deleting ${PIPE}"
109
-	rm -Rf "${PIPE}"
141
+	echo "Exiting with value: $retval"
142
+	if [ -e ${PIPE} ]; then
143
+		echo "Attempting to kill wget"
144
+		kill -9 ${WGETPID}
145
+		echo "Emptying pipe"
146
+		cat ${PIPE};
147
+		echo "Deleting Pipe ${PIPE}"
148
+		rm -Rf "${PIPE}"
149
+	fi;
110 150
 	exit $retval;
111 151
 }
112 152
 trap 'closeProgress' INT TERM EXIT
@@ -118,14 +158,21 @@ if [ "" != "${ISKDE}" -a "" != "${KDIALOG}" -a "" != "${DISPLAY}" ]; then
118 158
 	dcop ${progresswindow} showCancelButton true
119 159
 	TYPE="KDE"
120 160
 	readprogress
161
+	CONTINUE="0"
162
+	echo "Progress Bar Complete"
121 163
 elif [ "" != "${ISGNOME}" -a "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
122 164
 	echo "Progress dialog on Display: ${DISPLAY}"
123 165
 	TYPE="GNOME"
124 166
 	readprogress | ${ZENITY} --progress --auto-close --auto-kill --title "DMDirc: ${CAPTION}" --text "${CAPTION}"
167
+	CONTINUE="0"
168
+	echo "Progress Bar Complete"
125 169
 else
126 170
 	echo "Progress For: ${CAPTION}"
127 171
 	echo "-> 0%"
128 172
 	readprogress
173
+	CONTINUE="0"
129 174
 	echo ""
130 175
 	echo "Finished!"
131
-fi
176
+fi
177
+echo "Exiting progressbar"
178
+exit 0;

+ 30
- 15
installer/linux/setup.sh View File

@@ -23,6 +23,29 @@
23 23
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 24
 # SOFTWARE.
25 25
 
26
+# Check the which command exists, and if so make sure it behaves how we want
27
+# it to...
28
+WHICH=`which which 2>/dev/null`
29
+if [ "" = "${WHICH}" ]; then
30
+	echo "which command not found. Aborting.";
31
+	exit 0;
32
+else
33
+	# Solaris sucks
34
+	BADWHICH=`which /`
35
+	if [ "${BADWHICH}" != "" ]; then
36
+		echo "Replacing bad which command.";
37
+		# "Which" on solaris gives non-empty results for commands that don't exist
38
+		which() {
39
+			OUT=`${WHICH} ${1}`
40
+			if [ $? -eq 0 ]; then
41
+				echo ${OUT}
42
+			else
43
+				echo ""
44
+			fi;
45
+		}
46
+	fi;
47
+fi
48
+
26 49
 PIDOF=`which pidof`
27 50
 if [ "${PIDOF}" = "" ]; then
28 51
 	# For some reason some distros hide pidof...
@@ -38,8 +61,8 @@ if [ "${PIDOF}" != "" ]; then
38 61
 	ISKDE=`${PIDOF} -x -s kdeinit`
39 62
 	ISGNOME=`${PIDOF} -x -s gnome-panel`
40 63
 else
41
-	ISKDE=`ps ux | grep kdeinit | grep -v grep`
42
-	ISGNOME=`ps ux | grep gnome-panel | grep -v grep`
64
+	ISKDE=`ps -Af | grep kdeinit | grep -v grep`
65
+	ISGNOME=`ps -Af | grep gnome-panel | grep -v grep`
43 66
 fi;
44 67
 KDIALOG=`which kdialog`
45 68
 ZENITY=`which zenity`
@@ -64,7 +87,6 @@ errordialog() {
64 87
 }
65 88
 
66 89
 UNAME=`uname -a`
67
-isLinux=`echo ${UNAME} | grep -i linux`
68 90
 
69 91
 echo ""
70 92
 echo "---------------------"
@@ -103,17 +125,18 @@ installjre() {
103 125
 		result=$?
104 126
 	fi;
105 127
 	if [ ${result} -ne 0 ]; then
106
-		if [ "upgrade" != "${1}" ]; then
128
+		if [ "upgrade" = "${1}" ]; then
107 129
 			errordialog "DMDirc Setup" "Sorry, DMDirc setup can not continue without an updated version of java."
108 130
 		else
109 131
 			errordialog "DMDirc Setup" "Sorry, DMDirc setup can not continue without java."
110 132
 		fi;
111 133
 		exit 1;
112 134
 	else
113
-		if [ -e ".jrepath" ]; then
114
-			. .jrepath
115
-			JAVA=`which java`
135
+		if [ -e "${PWD}/jrepath" ]; then
136
+			echo "Found JREPath: ${PWD}/jrepath"
137
+			. ${PWD}/jrepath
116 138
 		fi;
139
+		JAVA=`which java`
117 140
 	fi;
118 141
 }
119 142
 
@@ -121,10 +144,6 @@ if [ "" != "${JAVA}" ]; then
121 144
 	echo "Success!"
122 145
 else
123 146
 	echo "Failed!"
124
-	if [ "" == "${isLinux}" ]; then
125
-		errordialog "DMDirc Setup" "Sorry, DMDirc setup can not continue without java 6."
126
-		exit 1
127
-	fi;
128 147
 	installjre "install"
129 148
 fi
130 149
 
@@ -183,10 +202,6 @@ if [ -e "DMDirc.jar" ]; then
183 202
 		echo "Running installer.."
184 203
 		${JAVA} -cp DMDirc.jar com.dmdirc.installer.Main ${isRoot}${isRelease}
185 204
 		if [ $? -ne 0 ]; then
186
-			if [ "" == "${isLinux}" ]; then
187
-				errordialog "DMDirc Setup" "Sorry, DMDirc setup can not continue without java 6."
188
-				exit 1
189
-			fi;
190 205
 			installjre "upgrade"
191 206
 			echo "Trying to run installer again.."
192 207
 			${JAVA} -cp DMDirc.jar com.dmdirc.installer.Main ${isRoot}${isRelease}

BIN
launcher/windows/DMDirc.exe View File


BIN
launcher/windows/DMDircUpdater.exe View File


Loading…
Cancel
Save