|
@@ -65,6 +65,27 @@ fi;
|
65
|
65
|
|
66
|
66
|
###ADDITIONAL_STUFF###
|
67
|
67
|
|
|
68
|
+PIDOF=`which pidof`
|
|
69
|
+if [ "${PIDOF}" = "" ]; then
|
|
70
|
+ # For some reason some distros hide pidof...
|
|
71
|
+ if [ -e /sbin/pidof ]; then
|
|
72
|
+ PIDOF=/sbin/pidof
|
|
73
|
+ elif [ -e /usr/sbin/pidof ]; then
|
|
74
|
+ PIDOF=/usr/sbin/pidof
|
|
75
|
+ fi;
|
|
76
|
+fi;
|
|
77
|
+
|
|
78
|
+## Helper Functions
|
|
79
|
+if [ "${PIDOF}" != "" ]; then
|
|
80
|
+ ISKDE=`${PIDOF} -x -s kdeinit`
|
|
81
|
+ ISGNOME=`${PIDOF} -x -s gnome-panel`
|
|
82
|
+else
|
|
83
|
+ ISKDE=`ps -Af | grep kdeinit | grep -v grep`
|
|
84
|
+ ISGNOME=`ps -Af | grep gnome-panel | grep -v grep`
|
|
85
|
+fi;
|
|
86
|
+KDIALOG=`which kdialog`
|
|
87
|
+ZENITY=`which zenity`
|
|
88
|
+
|
68
|
89
|
errordialog() {
|
69
|
90
|
# Send message to console.
|
70
|
91
|
echo ""
|
|
@@ -75,32 +96,34 @@ errordialog() {
|
75
|
96
|
echo "-----------------------------------------------------------------------"
|
76
|
97
|
|
77
|
98
|
# Now try to use the GUI Dialogs.
|
78
|
|
- PIDOF=`which pidof`
|
79
|
|
- if [ "${PIDOF}" = "" ]; then
|
80
|
|
- # For some reason some distros hide pidof...
|
81
|
|
- if [ -e /sbin/pidof ]; then
|
82
|
|
- PIDOF=/sbin/pidof
|
83
|
|
- elif [ -e /usr/sbin/pidof ]; then
|
84
|
|
- PIDOF=/usr/sbin/pidof
|
85
|
|
- fi;
|
86
|
|
- fi;
|
87
|
|
-
|
88
|
|
- ## Helper Functions
|
89
|
|
- if [ "${PIDOF}" != "" ]; then
|
90
|
|
- ISKDE=`${PIDOF} -x -s kdeinit`
|
91
|
|
- ISGNOME=`${PIDOF} -x -s gnome-panel`
|
92
|
|
- else
|
93
|
|
- ISKDE=`ps -Af | grep kdeinit | grep -v grep`
|
94
|
|
- ISGNOME=`ps -Af | grep gnome-panel | grep -v grep`
|
95
|
|
- fi;
|
96
|
|
- KDIALOG=`which kdialog`
|
97
|
|
- ZENITY=`which zenity`
|
98
|
99
|
if [ "" != "${ISKDE}" -a "" != "${KDIALOG}" -a "" != "${DISPLAY}" ]; then
|
99
|
100
|
echo "Dialog on Display: ${DISPLAY}"
|
100
|
|
- ${KDIALOG} --title "DMDirc: ${1}" --error "${1}\n\n${2}"
|
|
101
|
+ ${KDIALOG} --title "${1}" --error "${1}\n\n${2}"
|
101
|
102
|
elif [ "" != "${ISGNOME}" -a "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
|
102
|
103
|
echo "Dialog on Display: ${DISPLAY}"
|
103
|
|
- ${ZENITY} --error --title "DMDirc: ${1}" --text "${1}\n\n${2}"
|
|
104
|
+ ${ZENITY} --error --title "${1}" --text "${1}\n\n${2}"
|
|
105
|
+ fi
|
|
106
|
+}
|
|
107
|
+
|
|
108
|
+questiondialog() {
|
|
109
|
+ # Send question to console.
|
|
110
|
+ echo ""
|
|
111
|
+ echo "-----------------------------------------------------------------------"
|
|
112
|
+ echo "Question: ${1}"
|
|
113
|
+ echo "-----------------------------------------------------------------------"
|
|
114
|
+ echo "${2}"
|
|
115
|
+ echo "-----------------------------------------------------------------------"
|
|
116
|
+
|
|
117
|
+ # Now try to use the GUI Dialogs.
|
|
118
|
+ if [ "" != "${ISKDE}" -a "" != "${KDIALOG}" -a "" != "${DISPLAY}" ]; then
|
|
119
|
+ echo "Dialog on Display: ${DISPLAY}"
|
|
120
|
+ ${KDIALOG} --title "${1}" --yesno "${2}"
|
|
121
|
+ elif [ "" != "${ISGNOME}" -a "" != "${ZENITY}" -a "" != "${DISPLAY}" ]; then
|
|
122
|
+ echo "Dialog on Display: ${DISPLAY}"
|
|
123
|
+ ${ZENITY} --question --title "${1}" --text "${2}"
|
|
124
|
+ else
|
|
125
|
+ echo "Unable to ask question, assuming no."
|
|
126
|
+ return 1;
|
104
|
127
|
fi
|
105
|
128
|
}
|
106
|
129
|
|
|
@@ -253,8 +276,22 @@ while test -n "$1"; do
|
253
|
276
|
done
|
254
|
277
|
|
255
|
278
|
MD5BIN=`which md5sum`
|
|
279
|
+if [ "${MD5BIN}" = "" ]; then
|
|
280
|
+ MD5BIN=`which md5`
|
|
281
|
+fi;
|
256
|
282
|
AWK=`which awk`
|
257
|
283
|
getMD5() {
|
|
284
|
+ if [ "${MD5BIN}" != "" ]; then
|
|
285
|
+ echo "test" | ${MD5BIN} -
|
|
286
|
+ if [ $? -eq 0 ]; then
|
|
287
|
+ getMD5Linux $@
|
|
288
|
+ else
|
|
289
|
+ getMD5BSD $@
|
|
290
|
+ fi;
|
|
291
|
+ fi;
|
|
292
|
+}
|
|
293
|
+
|
|
294
|
+getMD5Linux() {
|
258
|
295
|
# Everything below the MD5SUM Line
|
259
|
296
|
MD5LINE=`grep ${GREPOPTS} "^MD5=\".*\"$" ${1}`
|
260
|
297
|
MD5LINE=$((${MD5LINE%%:*} + 1))
|
|
@@ -263,6 +300,15 @@ getMD5() {
|
263
|
300
|
return;
|
264
|
301
|
}
|
265
|
302
|
|
|
303
|
+getMD5BSD() {
|
|
304
|
+ # Everything below the MD5SUM Line
|
|
305
|
+ MD5LINE=`grep ${GREPOPTS} "^MD5=\".*\"$" ${1}`
|
|
306
|
+ MD5LINE=$((${MD5LINE%%:*} + 1))
|
|
307
|
+
|
|
308
|
+ MD5SUM=`tail ${TAILOPTS}${MD5LINE} "${1}" | ${MD5BIN} | ${AWK} '{print $1}'`
|
|
309
|
+ return;
|
|
310
|
+}
|
|
311
|
+
|
266
|
312
|
if [ "${MD5BIN}" != "" ]; then
|
267
|
313
|
if [ ${skipMD5} != "true" ]; then
|
268
|
314
|
#if [ -e "${0}.md5" ]; then
|
|
@@ -287,6 +333,18 @@ if [ "${MD5BIN}" != "" ]; then
|
287
|
333
|
echo "SUM expected is: ${MD5}"
|
288
|
334
|
if [ "${MD5SUM}" = "${MD5}" ]; then
|
289
|
335
|
echo "MD5 Check Passed!"
|
|
336
|
+ elif [ "${MD5SUM}" = "" -o "${MD5}" = "" ]; then
|
|
337
|
+ ERROR="The DMDirc installer is unable to verify the checksum of this download.";
|
|
338
|
+ if [ "${MD5SUM}" = "" ]; then
|
|
339
|
+ ERROR=${ERROR}"(Unable to calculate sum locally)";
|
|
340
|
+ else
|
|
341
|
+ ERROR=${ERROR}"(No checksum found in file)";
|
|
342
|
+ fi;
|
|
343
|
+
|
|
344
|
+ ERROR=${ERROR}"\nDo you want to continue anyway?";
|
|
345
|
+
|
|
346
|
+ questiondialog "DMDirc Setup: MD5 Check Failed!" "${ERROR}";
|
|
347
|
+ exit 1;
|
290
|
348
|
else
|
291
|
349
|
ERROR="This copy of the DMDirc installer appears to be damaged and will now exit.";
|
292
|
350
|
ERROR=${ERROR}"\nYou may choose to skip this check and run it anyway by passing the --nomd5 parameter";
|