Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update find-chromium.sh #16

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 48 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,56 @@ The following script symlinks Google Chrome's Widevine library to Chromium's dir

Paste this into your terminal:

For linux

```bash
git clone https://github.com/amidevous/chromium-widevine.git && \
cd chromium-widevine && \
sudo ./use-from-google-chrome.sh
```


```bash
git clone https://github.com/proprietary/chromium-widevine.git && \
wget https://github.com/amidevous/chromium-widevine/archive/refs/heads/master.tar.gz -O master.tar.gz && \
tar -xvf master.tar.gz && rm -f master.tar.gz && \
cd chromium-widevine-master && \
sudo ./use-from-google-chrome.sh
```


```bash
git clone https://github.com/amidevous/chromium-widevine.git && \
cd chromium-widevine && \
./use-from-google-chrome.sh
sudo ./use-standalone-widevine.sh
```



```bash
wget https://github.com/amidevous/chromium-widevine/archive/refs/heads/master.tar.gz -O master.tar.gz && \
tar -xvf master.tar.gz && rm -f master.tar.gz && \
cd chromium-widevine-master && \
sudo ./use-standalone-widevine.sh
```

For Windows Require and use on Cygwin Terminal (https://cygwin.org)

install https://cygwin.org/setup-x86_64.exe

minimal require package add wget, gzip, tar

open Cygwin Terminal in Admin Mode Require

enter command

```bash
wget https://github.com/amidevous/chromium-widevine/archive/refs/heads/master.tar.gz -O master.tar.gz && \
gunzip master.tar.gz && tar -xvf master.tar && rm -f master.tar && \
cd chromium-widevine-master && \
./use-standalone-widevine-windows.sh
```


## Test Widevine

Paste into terminal (*warning: restarts Chromium*):
Expand Down Expand Up @@ -61,9 +105,9 @@ killall -q -SIGTERM chromium-browser || \
Paste this into your shell:

```bash
git clone https://github.com/proprietary/chromium-widevine.git && \
rm -rf chromium-widevine && git clone https://github.com/amidevous/chromium-widevine.git && \
cd chromium-widevine && \
./use-standalone-widevine.sh && \
sudo ./use-standalone-widevine.sh && \
killall -q -SIGTERM chromium-browser || \
killall -q -SIGTERM chromium && \
exec $(command -v chromium-browser || command -v chromium) ./test-widevine.html &
Expand Down
14 changes: 14 additions & 0 deletions fetch-latest-widevine-windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Detect wget/curl
DLTOOL=""
which wget && DLTOOL="wget -O -"
which curl && DLTOOL="curl -L"
[[ -z ${DLTOOL} ]] && echo "No download tool found on this system" 1>&2 && exit 1
VERSION=$(${DLTOOL} https://dl.google.com/widevine-cdm/versions.txt | tail -n1)
[[ -z ${ARCH} ]] && echo "Architecture not supported" 1>&2 && exit 1
# Begin download
# Fix download argument for wget
DARG=${@}
[[ ${DLTOOL} == "wget -O -" ]] && DARG=`echo ${DARG} | sed 's/\-o /\-O /'` && DLTOOL="wget"
${DLTOOL} ${DARG} "https://dl.google.com/widevine-cdm/${VERSION}-win-x64.zip"
17 changes: 9 additions & 8 deletions fetch-latest-widevine.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
#!/bin/bash

# Detect wget/curl
DLTOOL=""
which wget && DLTOOL="wget -O -"
which curl && DLTOOL="curl -L"
[[ -z ${DLTOOL} ]] && echo "No download tool found on this system" 1>&2 && exit 1

# Set ARCH variable
ARCH=""
case `uname -m` in
i?86)
ARCH="ia32"
VERSION=$(${DLTOOL} https://dl.google.com/widevine-cdm/versions.txt | tail -n10 | head -1)
;;
x86_64)
ARCH="x64"
VERSION=$(${DLTOOL} https://dl.google.com/widevine-cdm/versions.txt | tail -n1)
;;
esac
[[ -z ${ARCH} ]] && echo "Architecture not supported" 1>&2 && exit 1

# Detect wget/curl
DLTOOL=""
which wget && DLTOOL="wget -O -"
which curl && DLTOOL="curl -L"
[[ -z ${DLTOOL} ]] && echo "No download tool found on this system" 1>&2 && exit 1

[[ -z ${ARCH} ]] && echo "Architecture not supported" 1>&2 && exit 1
# Begin download
VERSION=$(${DLTOOL} https://dl.google.com/widevine-cdm/versions.txt | tail -n1)
# Fix download argument for wget
DARG=${@}
[[ ${DLTOOL} == "wget -O -" ]] && DARG=`echo ${DARG} | sed 's/\-o /\-O /'` && DLTOOL="wget"
Expand Down
12 changes: 12 additions & 0 deletions find-chromium-windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
if [ -d "/cygdrive/c/Program Files/chromium" ]; then
CHROMIUM_DIR="/cygdrive/c/Program Files/chromium"
elif [ -d "/cygdrive/c/Program Files/chromium-browser" ]; then
CHROMIUM_DIR="/cygdrive/c/Program Files/chromium-browser"
elif [ -d "/cygdrive/c/Program Files (x86)/chromium" ]; then
CHROMIUM_DIR="/cygdrive/c/Program Files (x86)/chromium"
elif [ -d "/cygdrive/c/Program Files (x86)/chromium-browser" ]; then
CHROMIUM_DIR="/cygdrive/c/Program Files (x86)/chromium-browser"
fi
echo $CHROMIUM_DIR

20 changes: 20 additions & 0 deletions find-chromium.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash


# Find Chromium and its library directory

if ! [ -x "$(command -v chromium)" ] && ! [ -x "$(command -v chromium-browser)" ]; then
Expand All @@ -11,6 +12,20 @@ $ sudo apt install chromium
or
Ubuntu:
$ sudo apt install chromium-browser
or
Centos Red Hat Entreprise Alma Linux or Other fork:
require enable RPM Fussion https://rpmfusion.org/Configuration
$ sudo yum -y install epel-release
$ sudo yum -y install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm
$ sudo yum -y update
$ sudo yum install chromium
or
Fedora:
require enable RPM Fussion https://rpmfusion.org/Configuration
$ sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
$ sudo dnf -y update
$ sudo dnf install chromium

EOF
exit 1
fi
Expand All @@ -21,6 +36,9 @@ if [ -d /usr/lib/chromium ]; then
elif [ -d /usr/lib/chromium-browser ]; then
# Ubuntu
CHROMIUM_DIR=/usr/lib/chromium-browser
elif [ -d /usr/lib64/chromium-browser ]; then
# Fedoara or Centos or Red Hat Entreprise or Other fork
CHROMIUM_DIR=/usr/lib64/chromium-browser
elif [ -d $HOME/snap/chromium/current/.local ]; then
# Snap
mkdir -p $HOME/snap/chromium/current/.local/lib
Expand All @@ -30,6 +48,7 @@ else
Where is lib/ for chromium installed? Couldn't find it on the normal paths like:
/usr/lib/chromium
/usr/lib/chromium-browser
/usr/lib64/chromium-browser
$HOME/snap/chromium/current/local/lib

Edit ./find-chromium.sh and set CHROMIUM_DIR to that directory.
Expand All @@ -38,3 +57,4 @@ EOF
fi

echo $CHROMIUM_DIR

36 changes: 36 additions & 0 deletions use-standalone-widevine-windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
CHROMIUM_DIR="$(/bin/sh ./find-chromium-windows.sh)"
if [ -z "$CHROMIUM_DIR" ]; then
exit 1
fi

# Get Widevine archive
/bin/sh ./fetch-latest-widevine-windows.sh -o ./widevine.zip
# Expected directory structure:
# widevine.zip
# ├── LICENSE.txt
# ├── manifest.json
# └── widevinecdm.dll
# └── widevinecdm.dll.sig
# └── widevinecdm.dll.lib

# Extract Widevine and recreate this directory structure under the Chromium directory:
# /usr/lib/chromium/WidevineCdm
# ├── LICENSE
# ├── manifest.json
# └── _platform_specific
# └── win-x64
# └── widevinecdm.dll
# └── widevinecdm.dll.sig
# └── widevinecdm.dll.lib

mkdir -p "$CHROMIUM_DIR/WidevineCdm/_platform_specific/win-x64/"
cd "$CHROMIUM_DIR/WidevineCdm/"
unzip widevine.zip
mkdir -p "${CHROMIUM_DIR}/WidevineCdm/LICENSE/"
mv LICENSE.txt "${CHROMIUM_DIR}/WidevineCdm/LICENSE/"
mv widevinecdm.dll "$CHROMIUM_DIR/WidevineCdm/_platform_specific/win-x64/"
mv widevinecdm.dll.sig "$CHROMIUM_DIR/WidevineCdm/_platform_specific/win-x64/"
mv widevinecdm.dll.lib "$CHROMIUM_DIR/WidevineCdm/_platform_specific/win-x64/"
# clean up
rm ./widevine.zip
2 changes: 1 addition & 1 deletion use-standalone-widevine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ -z "$CHROMIUM_DIR" ]; then
fi

# Get Widevine archive
/bin/sh ./fetch-latest-widevine.sh -o ./widevine.zip
./fetch-latest-widevine.sh -o ./widevine.zip
# Expected directory structure:
# widevine.zip
# ├── LICENSE.txt
Expand Down