From 9d226fbaa52787fd8e9ff47ead369e043d349f6a Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 19 Mar 2025 15:00:09 +0800 Subject: [PATCH] Notify Android users [GitHub #176] --- tool/installer.sh | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/tool/installer.sh b/tool/installer.sh index a1c5896..17be77d 100644 --- a/tool/installer.sh +++ b/tool/installer.sh @@ -65,6 +65,20 @@ help() { } +get_arch() { + echo $(uname -m | tr '[:upper:]' '[:lower:]') +} + +get_platform() { + echo $(uname -s | awk '{print tolower($0)}') +} + +# Linux -> GNU/Linux +# Android -> Android +get_os() { + echo $(uname -o | awk '{print tolower($0)}') +} + # # 1. 若用户指定了安装目录,则安装至那里 # @@ -128,7 +142,7 @@ set_install_dir() { install() { - arch="$(uname -m | tr '[:upper:]' '[:lower:]')" + arch=$(get_arch) case "$arch" in x86_64) arch="x64" ;; @@ -144,10 +158,22 @@ install() { ;; esac - platform="$(uname -s | awk '{print tolower($0)}')" + platform=$(get_platform) case "$platform" in - linux) platform="linux" ;; + linux) + platform="linux" + whatos=$(get_os) + if [ "$whatos" = "android" ]; then + if [ "$userOpt_lang" = "zh" ]; then + info "抱歉, 暂无预编译二进制文件供安卓使用。请自行编译:" + else + info "Sorry, No precompiled binaries for Android! Please compile it on your own:" + fi + info "$ git clone https://gitee.com/RubyMetric/chsrc.git; cd chsrc; make" + exit 1 + fi + ;; darwin) platform="macos" ;; bsd|dragonfly) platform="bsd"