0
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2024-12-16 13:48:56 +00:00
Ian Leonard de67ea0a84 chrome: conditionally extract deb file
Signed-off-by: Ian Leonard <antonlacon@gmail.com>
2024-07-06 12:33:22 +00:00

31 lines
750 B
Python
Executable File

#!/usr/bin/python3
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2022-present Team LibreELEC (https://libreelec.tv)
import os
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)
if os.path.isfile(sys.argv[1]):
try:
ar = unix_ar.open(sys.argv[1])
except ValueError:
print(f"Unable to open archive: {sys.argv[1]}", file=sys.stderr)
sys.exit(1)
else:
tarball = ar.open('data.tar.xz/')
tar = tarfile.open(fileobj=tarball)
tar.extractall(path=sys.argv[2])
else:
print(f"File not found: {sys.argv[1]}", file=sys.stderr)
sys.exit(1)