You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# N.B. uname -r (OSREL) is not to be trusted on Mac OS X;
9
9
10
-
iftest -x /usr/bin/uname;then
11
-
OS=`/usr/bin/uname -s`
12
-
CPU=`/usr/bin/uname -m`
13
-
OSREL=`/usr/bin/uname -r | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*$/\1.\2.\3/'`
14
-
eliftest -x /bin/uname;then
15
-
OS=`/bin/uname -s`
16
-
CPU=`/bin/uname -m`
17
-
OSREL=`/bin/uname -r | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*$/\1.\2.\3/'`
10
+
iftest -x uname;then
11
+
OS=$(uname -s)
12
+
CPU=$(uname -m)
13
+
OSREL=$(uname -r | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*$/\1.\2.\3/')
14
+
eliftest -x uname;then
15
+
OS=$(uname -s)
16
+
CPU=$(uname -m)
17
+
OSREL=$(uname -r | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*$/\1.\2.\3/')
18
18
else
19
-
OS=`uname -s`
20
-
CPU=`uname -m`
21
-
OSREL=`uname -r | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*$/\1.\2.\3/'`
19
+
OS=$(uname -s)
20
+
CPU=$(uname -m)
21
+
OSREL=$(uname -r | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*$/\1.\2.\3/')
22
22
fi
23
23
24
-
test"$OS" = Darwin &&functionquietmd5 { /sbin/md5 -q "$1"2>/dev/null; }
25
-
test"$OS" = Darwin ||functionquietmd5 { /usr/bin/md5sum "$1"| sed 's/ .*$//'2>/dev/null; }
24
+
functionquietmd5() {
25
+
ifcommand -v md5 >/dev/null 2>&1;then
26
+
# macOS / BSD
27
+
md5 -q "$1"2>/dev/null
28
+
elifcommand -v md5sum >/dev/null 2>&1;then
29
+
# Linux / BusyBox
30
+
md5sum "$1"2>/dev/null | cut -d '' -f 1
31
+
else
32
+
echo"quietmd5: neither md5 nor md5sum found in PATH">&2
33
+
return 1
34
+
fi
35
+
}
26
36
27
-
test"$OS" = Darwin &&functiongeturl { FILE=`basename "$1"`; curl -C - "`echo $1| sed 's/ /%20/g'`" -o "$FILE"; }
28
-
test"$OS" = Darwin ||functiongeturl { wget -c "$1"; }
37
+
functiongeturl() {
38
+
local url="$1"
29
39
30
-
if [ "$OS"!= Darwin -a!-x"`which wget`" ];then
31
-
echo"cannot find wget. wget for Windows is available from http://gnuwin32.sourceforge.net/packages/wget.htm, probably as http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-setup.exe"1>&2
32
-
exit
33
-
fi
40
+
ifcommand -v curl >/dev/null 2>&1;then
41
+
curl -C - -O "$url"
42
+
elifcommand -v wget >/dev/null 2>&1;then
43
+
wget -c "$url"
44
+
else
45
+
echo"geturl: neither curl nor wget found in PATH">&2
46
+
return 1
47
+
fi
48
+
}
34
49
35
-
if unzip --help >/dev/null;then
36
-
true
37
-
else
50
+
if!command -v unzip >/dev/null 2>&1;then
38
51
echo'could not find unzip. you can find instructions on how to install it on google.'1>&2;
0 commit comments