diff --git a/widevine-installer b/widevine-installer index 78a1191..ed6f4a9 100755 --- a/widevine-installer +++ b/widevine-installer @@ -1,4 +1,6 @@ -#!/bin/sh +#!/usr/bin/env bash +# Modified from the original widevine-installer script to not prompt or +# download files. # SPDX-License-Identifier: MIT set -e @@ -20,129 +22,42 @@ set -e : ${CHROME_WIDEVINE_BASE:=$LIBDIR/chromium-browser} : ${MOZ_PREF_BASE:=$LIBDIR/firefox/defaults/pref} -[ -e $(dirname "$0")/widevine_fixup.py ] && SCRIPT_BASE="$(realpath "$(dirname "$0")")" - install_configs() { - cd "$SCRIPT_BASE" - echo "Copying config files..." - install -d -m 0755 "$DESTDIR/$INSTALL_BASE" - install -p -m 0644 -t "$DESTDIR/$INSTALL_BASE" ./conf/README - install -d -m 0755 "$DESTDIR/$CONFDIR/profile.d/" - install -p -m 0644 -t "$DESTDIR/$CONFDIR/profile.d/" ./conf/gmpwidevine.sh - install -d -m 0755 "$DESTDIR/$CHROME_WIDEVINE_BASE" - ln -sf "$INSTALL_BASE/WidevineCdm" "$DESTDIR/$CHROME_WIDEVINE_BASE/WidevineCdm" - install -d -m 0755 "$DESTDIR/$MOZ_PREF_BASE" - install -p -m 0644 -t "$DESTDIR/$MOZ_PREF_BASE" ./conf/gmpwidevine.js -} - -if [ "$1" = "--distinstall" ]; then - install_configs - install -d -m 0755 "$DESTDIR/$LIBEXECDIR/widevine-installer" - install -p -m 0644 -t "$DESTDIR/$LIBEXECDIR/widevine-installer" ./widevine_fixup.py - install -d -m 0755 "$DESTDIR/$BINDIR" - install -p -m 0755 -t "$DESTDIR/$BINDIR" ./widevine-installer - exit 0 -fi - -if [ "$(uname -m)" != "aarch64" ]; then - echo "This tool is only supported on aarch64 (ARM64) systems." - exit 1 -fi - -if [ "$(whoami)" != "root" ]; then - echo "This tool needs to be run as root." - exit 1 -fi - -verchk() { - ( - echo "2.36" - ldd --version | head -1 | cut -d" " -f4 - ) | sort -CV + cd "$SCRIPT_BASE" + echo "Copying config files..." + install -d -m 0755 "$DESTDIR/$INSTALL_BASE" + install -p -m 0644 -t "$DESTDIR/$INSTALL_BASE" ./conf/README + install -d -m 0755 "$DESTDIR/$CONFDIR/profile.d/" + install -p -m 0644 -t "$DESTDIR/$CONFDIR/profile.d/" ./conf/gmpwidevine.sh + install -d -m 0755 "$DESTDIR/$CHROME_WIDEVINE_BASE" + ln -sf "$INSTALL_BASE/WidevineCdm" "$DESTDIR/$CHROME_WIDEVINE_BASE/WidevineCdm" + install -d -m 0755 "$DESTDIR/$MOZ_PREF_BASE" + install -p -m 0644 -t "$DESTDIR/$MOZ_PREF_BASE" ./conf/gmpwidevine.js } -if ! verchk; then - echo "Your glibc version is too old. Widevine requires glibc 2.36 or newer." - exit 1 -fi - -echo "This script will download, adapt, and install a copy of the Widevine" -echo "Content Decryption Module for aarch64 systems." -echo -echo "Widevine is a proprietary DRM technology developed by Google." -echo "This script uses ARM64 builds intended for ChromeOS images and is" -echo "not supported nor endorsed by Google. The Asahi Linux community" -echo "also cannot provide direct support for using this proprietary" -echo "software, nor any guarantees about its security, quality," -echo "functionality, nor privacy. You assume all responsibility for" -echo "usage of this script and of the installed CDM." -echo -echo "This installer will only adapt the binary file format of the CDM" -echo "for interoperability purposes, to make it function on vanilla" -echo "ARM64 systems (instead of just ChromeOS). The CDM software" -echo "itself will not be modified in any way." -echo -echo "Widevine version to be installed: $WIDEVINE_VERSION" -echo -echo "Press enter to proceed, or Ctrl-C to cancel." -read dummy - -workdir="$(mktemp -d /tmp/widevine-installer.XXXXXXXX)" -[ -z "$workdir" ] && exit 1 # sanity check -[ ! -d "$workdir" ] && exit 1 # sanity check - -cd "$workdir" - -echo "Downloading LaCrOS (Chrome) image..." -URL="$DISTFILES_BASE/$LACROS_NAME-$LACROS_VERSION" -echo "URL: $URL" -curl -# -o lacros.squashfs "$URL" - -echo echo "Extracting Widevine..." unsquashfs -q lacros.squashfs 'WidevineCdm/*' -echo -echo "The Widevine license agreement follows:" -echo -echo =================================================================================== -cat squashfs-root/WidevineCdm/LICENSE -echo =================================================================================== -echo -echo "Press enter to proceed, or Ctrl-C to cancel." -read dummy - python3 "$SCRIPT_BASE/widevine_fixup.py" squashfs-root/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so libwidevinecdm.so echo echo "Installing..." -install -d -m 0755 "$INSTALL_BASE" -install -p -m 0755 -t "$INSTALL_BASE" libwidevinecdm.so -install -p -m 0644 -t "$INSTALL_BASE" squashfs-root/WidevineCdm/manifest.json -install -p -m 0644 -t "$INSTALL_BASE" squashfs-root/WidevineCdm/LICENSE +install -d -m 0755 "$DESTDIR/$INSTALL_BASE" +install -p -m 0755 -t "$DESTDIR/$INSTALL_BASE" libwidevinecdm.so +install -p -m 0644 -t "$DESTDIR/$INSTALL_BASE" squashfs-root/WidevineCdm/manifest.json +install -p -m 0644 -t "$DESTDIR/$INSTALL_BASE" squashfs-root/WidevineCdm/LICENSE echo "Setting up plugin for Firefox and Chromium-based browsers..." -mkdir -p "$INSTALL_BASE"/gmp-widevinecdm/system-installed -ln -sf ../../manifest.json "$INSTALL_BASE"/gmp-widevinecdm/system-installed/ -ln -sf ../../libwidevinecdm.so "$INSTALL_BASE"/gmp-widevinecdm/system-installed/ -mkdir -p "$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_{arm64,x64} +mkdir -p "$DESTDIR/$INSTALL_BASE"/gmp-widevinecdm/system-installed +ln -sf ../../manifest.json "$DESTDIR/$INSTALL_BASE"/gmp-widevinecdm/system-installed/ +ln -sf ../../libwidevinecdm.so "$DESTDIR/$INSTALL_BASE"/gmp-widevinecdm/system-installed/ +mkdir -p "$DESTDIR/$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_{arm64,x64} # Hack because Chromium hardcodes a check for this right now... -touch "$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so -ln -sf ../manifest.json "$INSTALL_BASE"/WidevineCdm -ln -sf ../../../libwidevinecdm.so "$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_arm64/ +touch "$DESTDIR/$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so +ln -sf ../manifest.json "$DESTDIR/$INSTALL_BASE"/WidevineCdm +ln -sf ../../../libwidevinecdm.so "$DESTDIR/$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_arm64/ if [ "$COPY_CONFIGS" = 1 ]; then - install_configs + install_configs fi -echo "Cleaning up..." -cd / -rm -rf "$workdir" - -echo -echo "Installation complete!" -if [ "$COPY_CONFIGS" = 1 ]; then - echo "You may need to log out and back in for the changes to take effect." -else - echo "Please restart your browser for the changes to take effect." -fi