Skip to content

Commit fcaae76

Browse files
authored
Merge pull request #1 from bernardkkt/master
Choose curl/wget flexibly as download tool
2 parents 6624d38 + 49d2ae5 commit fcaae76

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

fetch-latest-widevine.sh

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
#!/bin/bash
22

3-
ARCH=x64 # or ia32
4-
VERSION=$(curl -s https://dl.google.com/widevine-cdm/versions.txt | tail -n1)
3+
# Set ARCH variable
4+
ARCH=""
5+
case `uname -m` in
6+
i?86)
7+
ARCH="ia32"
8+
;;
9+
x86_64)
10+
ARCH="x64"
11+
;;
12+
esac
13+
[[ -z ${ARCH} ]] && echo "Architecture not supported" 1>&2 && exit 1
514

6-
curl -fsSL "$@" "https://dl.google.com/widevine-cdm/${VERSION}-linux-${ARCH}.zip"
15+
# Detect wget/curl
16+
DLTOOL=""
17+
which wget && DLTOOL="wget -O -"
18+
which curl && DLTOOL="curl -L"
19+
[[ -z ${DLTOOL} ]] && echo "No download tool found on this system" 1>&2 && exit 1
20+
21+
# Begin download
22+
VERSION=$(${DLTOOL} https://dl.google.com/widevine-cdm/versions.txt | tail -n1)
23+
# Fix download argument for wget
24+
DARG=${@}
25+
[[ ${DLTOOL} == "wget -O -" ]] && DARG=`echo ${DARG} | sed 's/\-o /\-O /'` && DLTOOL="wget"
26+
${DLTOOL} ${DARG} "https://dl.google.com/widevine-cdm/${VERSION}-linux-${ARCH}.zip"

0 commit comments

Comments
 (0)