forked from XiaomiMiMo/MiMo-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal-install.sh
More file actions
executable file
·59 lines (50 loc) · 1.23 KB
/
Copy pathlocal-install.sh
File metadata and controls
executable file
·59 lines (50 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
set -euo pipefail
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
package_dir="$repo_dir/packages/opencode"
install_dir="${MIMOCODE_INSTALL_DIR:-$HOME/.mimocode/bin}"
if ! command -v bun >/dev/null 2>&1; then
echo "bun is required but was not found in PATH" >&2
exit 1
fi
case "$(uname -s)" in
Darwin)
platform="darwin"
;;
Linux)
platform="linux"
if ldd --version 2>&1 | grep -qi musl; then
echo "musl-based Linux distributions such as Alpine are not supported" >&2
exit 1
fi
;;
*)
echo "Unsupported operating system: $(uname -s)" >&2
exit 1
;;
esac
case "$(uname -m)" in
arm64 | aarch64) arch="arm64" ;;
x86_64 | amd64) arch="x64" ;;
*)
echo "Unsupported architecture: $(uname -m)" >&2
exit 1
;;
esac
(
cd "$package_dir"
bun run build:local
)
binary="$package_dir/dist/mimocode-$platform-$arch/bin/mimo"
if [[ ! -f "$binary" ]]; then
echo "Built binary not found: $binary" >&2
exit 1
fi
mkdir -p "$install_dir"
temporary="$install_dir/.mimo.$$"
trap 'rm -f "$temporary"' EXIT
install -m 755 "$binary" "$temporary"
mv -f "$temporary" "$install_dir/mimo"
trap - EXIT
echo "Installed mimo to $install_dir/mimo"
"$install_dir/mimo" --version