Skip to content

Instantly share code, notes, and snippets.

@Dwyriel
Created December 10, 2022 07:24
Show Gist options
  • Select an option

  • Save Dwyriel/8fc04b8114aa3770752bf47bf8486452 to your computer and use it in GitHub Desktop.

Select an option

Save Dwyriel/8fc04b8114aa3770752bf47bf8486452 to your computer and use it in GitHub Desktop.
Install/update widevine for chromium
#!/bin/bash
#A compact version of https://github.com/proprietary/chromium-widevine specialized for my own system and uses
if [ "$EUID" != 0 ]; then
sudo "$0" "$@"
exit $?
fi
#wherever you want, preferably where script is located
WIDEVINE_ZIP_PATH=/home/dwyriel/LinuxScripts/widevine.zip
#where chromium is installed, find with command "whereis chromium"
CHROMIUM_DIR=/usr/lib/chromium
echo "Checking latest widevine version"
VERSION=$(/usr/bin/curl -s -L https://dl.google.com/widevine-cdm/versions.txt | tail -n1)
echo "Downloading widevine"
/usr/bin/curl -s -L "https://dl.google.com/widevine-cdm/${VERSION}-linux-x64.zip" -o $WIDEVINE_ZIP_PATH
echo "Setting up the directory and extracting widevine"
sudo mkdir -p "$CHROMIUM_DIR/WidevineCdm/_platform_specific/linux_x64"
unzip -p $WIDEVINE_ZIP_PATH LICENSE.txt | sudo dd status=none of="$CHROMIUM_DIR/WidevineCdm/LICENSE"
unzip -p $WIDEVINE_ZIP_PATH manifest.json | sudo dd status=none of="$CHROMIUM_DIR/WidevineCdm/manifest.json"
unzip -p $WIDEVINE_ZIP_PATH libwidevinecdm.so | sudo dd status=none of="$CHROMIUM_DIR/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"
find "$CHROMIUM_DIR/WidevineCdm" -type d -exec sudo chmod 0755 '{}' \;
find "$CHROMIUM_DIR/WidevineCdm" -type f -exec sudo chmod 0644 '{}' \;
echo "Cleaning up"
rm $WIDEVINE_ZIP_PATH
echo "Done :)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment