Skip to content

Commit

Permalink
Fix build(used chrome) for non x86_64 architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
yoori committed Nov 7, 2024
1 parent 8aff21b commit 0802f7a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ RUN ./gost-install.sh --install
COPY utils/linux_chrome_installer.py /opt/flare_bypasser/bin/linux_chrome_installer.py
RUN python3 /opt/flare_bypasser/bin/linux_chrome_installer.py \
--version-prefix="$CHROME_VERSION" \
--install-root=/opt/flare_bypasser/installed_chrome/ || \
--install-root=/opt/flare_bypasser/installed_chrome/ \
--arch=$(arch) || \
{ echo "Can't install chrome (required version '$CHROME_VERSION')" >&2 ; exit 1 ; }


Expand Down
4 changes: 2 additions & 2 deletions rootfs/opt/flare_bypasser/bin/FlareBypasserRun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ chrome_diagnostic() {
cat "$CHROME_OUTPUT_FILE" >&2
fi

kill "$XVFB_PID"
kill "$CHROME_PID"
kill "$XVFB_PID" 2>/dev/null
kill "$CHROME_PID" 2>/dev/null

return $EXIT_CODE
}
Expand Down
15 changes: 12 additions & 3 deletions utils/linux_chrome_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,15 @@ def unzip_package(
shutil.rmtree(unzip_path)


def download_and_install(version_prefix = None, install_root = None):
target_platform = "linux64"
def download_and_install(version_prefix = None, install_root = None, arch = 'x86_64'):
if arch == 'x86_64':
target_platform = "linux64"
elif arch == 'aarch64' : # < Raspberry, ARM based MacOS
target_platform = 'mac-arm64'
elif arch == 'i386': # < Intel based MacOS
target_platform = 'mac-x64'
else :
raise Exception("Unknown platform: " + str(arch))

chrome_download_url = None
with urlopen(
Expand Down Expand Up @@ -86,12 +93,14 @@ def download_and_install(version_prefix = None, install_root = None):
parser = argparse.ArgumentParser(description='linux_chrome_installer.')
parser.add_argument("-v", "--version-prefix", type=str, default='120.')
parser.add_argument("-i", "--install-root", type=str, default='/usr/bin')
parser.add_argument("--arch", type=str, default='x86_64')
args = parser.parse_args()

try:
res = download_and_install(
version_prefix = args.version_prefix,
install_root = args.install_root
install_root = args.install_root,
arch = args.arch
)
except Exception as e:
logging.error("Can't install chrome: " + str(e))
Expand Down

0 comments on commit 0802f7a

Please sign in to comment.