mirror of
https://github.com/m1k1o/neko.git
synced 2026-11-03 00:11:48 -06:00
d2ec13a236
* chromium arm64 widevine * brave arm64 widevine * firefox arm64 widevine * vivaldi arm64 widevine * Update browser.md for arm64 drm * add link to instruction * add widevine-installer * widevine base image, tools in utils, move files for chromiums * include installer in runtime * add runtime/widevine-installer in repo-structure
133 lines
4.6 KiB
Bash
Executable File
133 lines
4.6 KiB
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
set -e
|
|
|
|
# Set to 0 if packaged and the configs are pre-installed
|
|
: ${DESTDIR:=/}
|
|
: ${CONFDIR:=/etc}
|
|
: ${LIBDIR:=/usr/lib64}
|
|
: ${BINDIR:=/usr/bin}
|
|
: ${LIBEXECDIR:=/usr/libexec}
|
|
: ${STATEDIR:=/var/lib}
|
|
: ${ENVIRONMENTDIR:=/usr/lib/environment.d}
|
|
: ${SCRIPT_BASE:=$LIBEXECDIR/widevine-installer}
|
|
: ${INSTALL_BASE:=$STATEDIR/widevine}
|
|
: ${DISTFILES_BASE:=https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles}
|
|
: ${LACROS_NAME:=chromeos-lacros-arm64-squash-zstd}
|
|
: ${LACROS_VERSION:=120.0.6098.0}
|
|
: ${WIDEVINE_VERSION:=4.10.2662.3}
|
|
: ${CHROME_WIDEVINE_BASE:=$LIBDIR/chromium-browser}
|
|
: ${MOZ_PREF_BASE:=$LIBDIR/firefox/defaults/pref}
|
|
|
|
[ -e $(dirname "$0")/widevine_fixup.py ] && SCRIPT_BASE="$(realpath "$(dirname "$0")")"
|
|
|
|
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
|
|
}
|
|
|
|
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
|
|
|
|
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
|
|
mkdir -p "$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_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/
|
|
|
|
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
|