GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — update install script to handle musl & avx · jpr5/opencode@e404bf3

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • install
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎install‎

Copy file name to clipboardExpand all lines: install
+60-21Lines changed: 60 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,82 @@ requested_version=${VERSION:-}
1111

1212
raw_os=$(uname -s)
1313
os=$(echo "$raw_os" | tr '[:upper:]' '[:lower:]')
14-
# Normalize various Unix-like identifiers
1514
case "$raw_os" in
1615
Darwin*) os="darwin" ;;
1716
Linux*) os="linux" ;;
1817
MINGW*|MSYS*|CYGWIN*) os="windows" ;;
19-
esac
20-
arch=$(uname -m)
18+
esac
2119

20+
arch=$(uname -m)
2221
if [[ "$arch" == "aarch64" ]]; then
2322
arch="arm64"
24-
elif [[ "$arch" == "x86_64" ]]; then
23+
fi
24+
if [[ "$arch" == "x86_64" ]]; then
2525
arch="x64"
2626
fi
2727

28-
if [ "$os" = "linux" ]; then
29-
filename="$APP-$os-$arch.tar.gz"
30-
else
31-
filename="$APP-$os-$arch.zip"
28+
if [ "$os" = "darwin" ] && [ "$arch" = "x64" ]; then
29+
rosetta_flag=$(sysctl -n sysctl.proc_translated 2>/dev/null || echo 0)
30+
if [ "$rosetta_flag" = "1" ]; then
31+
arch="arm64"
32+
fi
3233
fi
3334

34-
35-
case "$filename" in
36-
*"-linux-"*)
37-
[[ "$arch" == "x64" || "$arch" == "arm64" ]] || exit 1
38-
;;
39-
*"-darwin-"*)
40-
[[ "$arch" == "x64" || "$arch" == "arm64" ]] || exit 1
35+
combo="$os-$arch"
36+
case "$combo" in
37+
linux-x64|linux-arm64|darwin-x64|darwin-arm64|windows-x64)
4138
;;
42-
*"-windows-"*)
43-
[[ "$arch" == "x64" ]] || exit 1
44-
;;
45-
*)
46-
echo -e "${RED}Unsupported OS/Arch: $os/$arch${NC}"
47-
exit 1
39+
*)
40+
echo -e "${RED}Unsupported OS/Arch: $os/$arch${NC}"
41+
exit 1
4842
;;
4943
esac
5044

45+
archive_ext=".zip"
46+
if [ "$os" = "linux" ]; then
47+
archive_ext=".tar.gz"
48+
fi
49+
50+
is_musl=false
51+
if [ "$os" = "linux" ]; then
52+
if [ -f /etc/alpine-release ]; then
53+
is_musl=true
54+
fi
55+
56+
if command -v ldd >/dev/null 2>&1; then
57+
if ldd --version 2>&1 | grep -qi musl; then
58+
is_musl=true
59+
fi
60+
fi
61+
fi
62+
63+
needs_baseline=false
64+
if [ "$arch" = "x64" ]; then
65+
if [ "$os" = "linux" ]; then
66+
if ! grep -qi avx2 /proc/cpuinfo 2>/dev/null; then
67+
needs_baseline=true
68+
fi
69+
fi
70+
71+
if [ "$os" = "darwin" ]; then
72+
avx2=$(sysctl -n hw.optional.avx2_0 2>/dev/null || echo 0)
73+
if [ "$avx2" != "1" ]; then
74+
needs_baseline=true
75+
fi
76+
fi
77+
fi
78+
79+
target="$os-$arch"
80+
if [ "$needs_baseline" = "true" ]; then
81+
target="$target-baseline"
82+
fi
83+
if [ "$is_musl" = "true" ]; then
84+
target="$target-musl"
85+
fi
86+
87+
filename="$APP-$target$archive_ext"
88+
89+
5190
if [ "$os" = "linux" ]; then
5291
if ! command -v tar >/dev/null 2>&1; then
5392
echo -e "${RED}Error: 'tar' is required but not installed.${NC}"

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.