From 6cd1357641f67ac5a80cb6275732b5df3f9a2c31 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Tue, 26 Mar 2024 12:49:18 +0800 Subject: [PATCH] Feat: install script auto detech amd64 micro --- script/install.sh | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/script/install.sh b/script/install.sh index 15157b84..38fe5be2 100755 --- a/script/install.sh +++ b/script/install.sh @@ -10,7 +10,6 @@ function Help() { echo "-h: help" echo "-v: install version (default: latest)" echo "-p: github proxy (default: https://mirror.ghproxy.com/)" - # Microarchitecture echo "-a: microarchitecture (no default value)" echo " example: -a v2" } @@ -26,7 +25,6 @@ function Init() { InitOS InitArch InitDownloadTools - Microarchitecture="" } function ParseArgs() { @@ -70,9 +68,9 @@ function InitOS() { Linux) OS='linux' ;; - Darwin) - OS='darwin' - ;; + # Darwin) + # OS='darwin' + # ;; *) echo "OS: ${OS} not supported" exit 2 @@ -80,10 +78,27 @@ function InitOS() { esac } +AMD64_MICRO_DETECTION_SCRIPT=$( + cat < 0) { print "v" level; exit 0 } + exit 1 +} +EOF +) + function InitArch() { case "$(uname -m)" in x86_64 | amd64) ARCH='amd64' + if [ ! "$Microarchitecture" ]; then + Microarchitecture="$(awk "$AMD64_MICRO_DETECTION_SCRIPT")" + fi ;; i?86 | x86) ARCH='386'