Skip to content

refactor(install): improve OS and architecture detection #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,33 @@ goarch=$(uname -m)
echo "Current OS: $goos"
echo "Current Architecture: $goarch"

if [ "$goos" == "darwin" ]; then
ext=""
elif [ "$goos" == "linux" ] || [ "$goos" == "freebsd" ]; then
ext=""
else
echo "Unsupported OS: $goos"
exit 1
fi
# 判断操作系统是否支持
case "$goos" in
darwin|linux|freebsd)
ext=""
;;
*)
echo "Unsupported OS: $goos"
exit 1
;;
esac

if [ "$goarch" == "x86_64" ]; then
arch="amd64"
elif [ "$goarch" == "i386" ]; then
arch="386"
elif [ "$goarch" == "arm64" ]; then
arch="arm64"
else
echo "Unsupported Architecture: $goarch"
exit 1
fi
# 映射架构到标准格式
case "$goarch" in
x86_64|amd64)
arch="amd64"
;;
i386|i686)
arch="386"
;;
aarch64|arm64|ARM64)
arch="arm64"
;;
*)
echo "Unsupported Architecture: $goarch"
exit 1
;;
esac

BIN_VERSION="$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/NodeSeekDev/NskCore/releases/latest)"
BIN_VERSION=${BIN_VERSION##*/}
Expand Down