void-packages/srcpkgs/chromium-widevine/INSTALL

44 lines
1.4 KiB
Plaintext

# INSTALL
checksum=b429124b27f9b5ff3a63229823af0d4200020698eb58b75027897ba5b5e327eb
_baseUrl="https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable"
_filename="google-chrome-stable_${VERSION%_*}-1_amd64.deb"
DISTFILE="${_baseUrl}/${_filename}"
BUILD_DIR="$(mktemp -d "${TMPDIR:-/tmp}/$PKGNAME.XXXXXX")"
case "$ACTION" in
post)
# Actions to execute before the package files are unpacked.
mkdir -p "${BUILD_DIR}"
xbps-uhelper fetch "${DISTFILE}>${BUILD_DIR}/${PKGNAME}.deb"
# Verify that the archive is as expected
if [ "$(xbps-digest "${BUILD_DIR}/${PKGNAME}.deb")" != "${checksum}" ]; then
echo "broken file: $_filename"
exit 1
fi
# Attempt to unpack the archive
(
cd "${BUILD_DIR}" && \
ar x "${PKGNAME}.deb" && \
tar xf data.tar.xz --wildcards './opt/google/chrome/WidevineCdm/'
) || exit 1
# Remove previous components
mkdir -p usr/lib/chromium
rm -rf usr/lib/chromium/WidevineCdm
rm -f usr/lib/chromium-dev/WidevineCdm usr/lib/chromium/libwidevinecdm.so
# Install new components
mv "${BUILD_DIR}/opt/google/chrome/WidevineCdm" usr/lib/chromium
ln -Ts WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so usr/lib/chromium/libwidevinecdm.so
mkdir -p usr/lib/chromium-dev
ln -Ts ../chromium/WidevineCdm usr/lib/chromium-dev/WidevineCdm
# Cleanup
rm -r "${BUILD_DIR}"
;;
esac