chrome: use new deb_extract_data python script to unpack chrome.deb

Recent Google chrome.deb files for Ubuntu do have two issues in our environment:

1) The ar archive contains illegal file mode 644 instead of 100644. Busybox ar
   is refusing this.
2) The xz/lzma compression is using CRC64. Busybox only implements CRC32.

Work around is using Python code to unpack ar archive and tar.xz.

Co-authored-by: CvH <1355173+CvH@users.noreply.github.com>
This commit is contained in:
mglae 2022-11-28 19:53:52 +01:00 committed by Rudi Heitbaum
parent c8cc75db39
commit d96f86708b
3 changed files with 26 additions and 7 deletions

View File

@ -13,7 +13,7 @@ PKG_DEPENDS_TARGET="toolchain at-spi2-atk atk cairo chrome-libXcomposite \
chrome-libXdamage chrome-libXfixes chrome-libXi chrome-libXrender \
chrome-libXtst chrome-libxcb chrome-libxkbcommon chrome-libxshmfence cups \
gdk-pixbuf gtk3 harfbuzz-icu libXcursor libxss nss pango \
scrnsaverproto unclutter"
scrnsaverproto unclutter unix_ar"
PKG_SECTION="browser"
PKG_SHORTDESC="Google Chrome Browser"
PKG_LONGDESC="Google Chrome Browser"
@ -29,7 +29,7 @@ make_target() {
}
addon() {
mkdir -p ${ADDON_BUILD}/${PKG_ADDON_ID}/{bin,config,lib}
mkdir -p ${ADDON_BUILD}/${PKG_ADDON_ID}/{bin,config,lib,resources}
# config
cp -P ${PKG_DIR}/config/* ${ADDON_BUILD}/${PKG_ADDON_ID}/config
@ -59,6 +59,9 @@ addon() {
$(get_install_dir chrome-libXtst)/usr/lib/libXtst.so.6 \
$(get_install_dir pango)/usr/lib/{libpangocairo-1.0.so.0,libpango-1.0.so.0,libpangoft2-1.0.so.0} \
${ADDON_BUILD}/${PKG_ADDON_ID}/lib
# unix_ar
cp -P $(get_build_dir unix_ar)/unix_ar.py ${ADDON_BUILD}/${PKG_ADDON_ID}/resources
}
post_install_addon() {

View File

@ -52,13 +52,11 @@ rm -f ${CONTROL_FILE} ${DATA_FILE}
rm -f ${CONTROL_FILE} ${DATA_FILE}
## extract chrome
# extrat chrome.deb
# extrat chrome.deb data to temp
kodi-send --action="Notification(Extracting Chrome,starting,1000,${ICON})" >/dev/null
ar -x ${CHROME_FILE}
deb_extract_data ${CHROME_FILE} $ADDON_DIR/tmp_download
# extract data.tar.xz to chrome-bin directory
mkdir $ADDON_DIR/chrome-bin
tar xf data.tar.xz --strip-components=4 -C $ADDON_DIR/chrome-bin ./opt/google/chrome
mv opt/google/chrome $ADDON_DIR/chrome-bin
# cleanup
cd $ADDON_DIR

View File

@ -0,0 +1,18 @@
#!/usr/bin/python3
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2022-present Team LibreELEC (https://libreelec.tv)
import sys
sys.path.append('/storage/.kodi/addons/browser.chrome/resources')
import unix_ar
import tarfile
if len(sys.argv) != 3:
print("Parameter error", file=sys.stderr)
sys.exit(1)
ar = unix_ar.open(sys.argv[1])
tarball = ar.open('data.tar.xz/')
tar = tarfile.open(fileobj=tarball)
tar.extractall(path=sys.argv[2])