|
@@ -115,9 +115,27 @@ if [ "${ISAINFO}" != "" ]; then
|
115
|
115
|
fi;
|
116
|
116
|
URL="http://www.dmdirc.com/getjava/`uname -s`/${ARCH}"
|
117
|
117
|
|
118
|
|
-length=`wget --spider ${URL} 2>&1 | grep "Length:"| awk '{print $2, $3}' | sed 's/,//g'`
|
119
|
|
-actualLength=${length%% *}
|
120
|
|
-niceLength=`echo ${length##* } | sed 's/[()]//g'`
|
|
118
|
+WGET=`which wget`
|
|
119
|
+FETCH=`which fetch`
|
|
120
|
+CURL=`which curl`
|
|
121
|
+if [ "${WGET}" != "" ]; then
|
|
122
|
+ length=`${WGET} --spider ${URL} 2>&1 | grep "Length:"| awk '{print $2, $3}' | sed 's/,//g'`
|
|
123
|
+ actualLength=${length%% *}
|
|
124
|
+elif [ "${FETCH}" != "" ]; then
|
|
125
|
+ actualLength=`${FETCH} -s ${URL}`
|
|
126
|
+elif [ "${CURL}" != "" ]; then
|
|
127
|
+ length=`${CURL} -# -I ${URL} 2>&1 | grep "Content-Length:"| awk '{print $2}'`
|
|
128
|
+fi;
|
|
129
|
+
|
|
130
|
+# Convert the length from Bytes to something user-friendly
|
|
131
|
+if [ ${actualLength} -ge 1048576 ]; then
|
|
132
|
+ niceLength=`echo "scale=2; ${actualLength}/1048576" | bc`"MB"
|
|
133
|
+elif [ ${actualLength} -ge 1024 ]; then
|
|
134
|
+ niceLength=`echo "scale=2; ${actualLength}/1024" | bc`"KB"
|
|
135
|
+else
|
|
136
|
+ niceLength=`echo "scale=2; ${actualLength}/1024" | bc`"B"
|
|
137
|
+ echo ${niceLength}
|
|
138
|
+fi;
|
121
|
139
|
|
122
|
140
|
if [ "${actualLength}" = "6" ]; then
|
123
|
141
|
# Unable to download.
|
|
@@ -150,8 +168,16 @@ else
|
150
|
168
|
fi;
|
151
|
169
|
if [ $result -eq 0 ]; then
|
152
|
170
|
PIPE=`mktemp -p ${PWD} progresspipe.XXXXXXXXXXXXXX`
|
153
|
|
- wget -q ${URL} -O jre.bin &
|
154
|
|
- wgetpid=${!}
|
|
171
|
+ if [ "${WGET}" != "" ]; then
|
|
172
|
+ ${WGET} -q -O jre.bin ${URL} &
|
|
173
|
+ wgetpid=${!}
|
|
174
|
+ elif [ "${FETCH}" != "" ]; then
|
|
175
|
+ ${FETCH} -q -o jre.bin &
|
|
176
|
+ wgetpid=${!}
|
|
177
|
+ elif [ "${CURL}" != "" ]; then
|
|
178
|
+ ${CURL} -s -o jre.bin ${URL} &
|
|
179
|
+ wgetpid=${!}
|
|
180
|
+ fi;
|
155
|
181
|
/bin/sh ${PWD}/progressbar.sh "Downloading JRE.." ${actualLength} ${PIPE} ${wgetpid} &
|
156
|
182
|
progressbarpid=${!}
|
157
|
183
|
while [ `ps -p ${wgetpid} | wc -l` = 2 ]; do
|