summaryrefslogtreecommitdiff
path: root/install.sh
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-22 16:39:15 +0000
committerGitHub <noreply@github.com>2026-02-22 16:39:15 +0000
commita8dd432fd58a3036cf952eec691981dff43a7c7e (patch)
tree925d67ce3f4a00b744a320c920be57f13f5b15a5 /install.sh
parent0c00b6aa26baf49ba02164cd44aab16f9c804bbd (diff)
downloadsoryu-a8dd432fd58a3036cf952eec691981dff43a7c7e.tar.gz
soryu-a8dd432fd58a3036cf952eec691981dff43a7c7e.zip
fix: remove duplicate daemon page, add ARM64 binary, use makima.jp URLs (#78)
* feat: soryu-co/soryu - makima: Add macOS ARM64 binary to daemon download bundle * feat: soryu-co/soryu - makima: Remove duplicate Daemon nav entry and route * feat: soryu-co/soryu - makima: Update download URLs to use makima.jp hosted instance
Diffstat (limited to 'install.sh')
-rw-r--r--install.sh88
1 files changed, 12 insertions, 76 deletions
diff --git a/install.sh b/install.sh
index b7a96fe..3dc76e1 100644
--- a/install.sh
+++ b/install.sh
@@ -5,7 +5,6 @@ set -e
# Usage: curl -fsSL https://raw.githubusercontent.com/soryu-co/soryu/master/install.sh | bash
# curl -fsSL https://raw.githubusercontent.com/soryu-co/soryu/master/install.sh | INSTALL_DIR=/opt/bin bash
-REPO="soryu-co/soryu"
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
BINARY_NAME="makima"
@@ -39,10 +38,6 @@ check_dependencies() {
missing="$missing curl"
fi
- if ! command -v tar &> /dev/null; then
- missing="$missing tar"
- fi
-
if [ -n "$missing" ]; then
print_error "Missing required tools:$missing"
print_info "Please install the missing tools and try again."
@@ -90,29 +85,11 @@ detect_arch() {
esac
}
-# Get the latest release version from GitHub API
-get_latest_version() {
- local version
- version=$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
-
- if [ -z "$version" ]; then
- print_error "Failed to fetch latest release version from GitHub"
- exit 1
- fi
-
- echo "$version"
-}
-
-# Construct the download URL for the release asset
+# Construct the download URL for the binary
get_download_url() {
- local version=$1
- local os=$2
- local arch=$3
-
- # Handle macOS arm64 vs Linux x86_64 naming
- local asset_name="makima-${version}-${os}-${arch}.tar.gz"
-
- echo "https://github.com/$REPO/releases/download/${version}/${asset_name}"
+ local os=$1
+ local arch=$2
+ echo "https://api.makima.jp/api/v1/daemon/download/${os}-${arch}"
}
# Download and install the binary
@@ -120,55 +97,26 @@ install_binary() {
local url=$1
local tmpdir
tmpdir=$(mktemp -d)
- local tarball="$tmpdir/makima.tar.gz"
+ local binary="$tmpdir/$BINARY_NAME"
print_info "Downloading from: $url"
- # Download the tarball
- if ! curl -fsSL "$url" -o "$tarball"; then
- print_error "Failed to download release from: $url"
- print_info "Please check if the release exists for your platform."
+ if ! curl -fsSL "$url" -o "$binary"; then
+ print_error "Failed to download from: $url"
+ print_info "Please check if the binary is available for your platform."
rm -rf "$tmpdir"
exit 1
fi
- # Verify download was successful
- if [ ! -f "$tarball" ] || [ ! -s "$tarball" ]; then
+ if [ ! -f "$binary" ] || [ ! -s "$binary" ]; then
print_error "Downloaded file is empty or missing"
rm -rf "$tmpdir"
exit 1
fi
- # Extract the tarball
- print_info "Extracting archive..."
- if ! tar -xzf "$tarball" -C "$tmpdir"; then
- print_error "Failed to extract archive"
- rm -rf "$tmpdir"
- exit 1
- fi
-
- # Find the binary (it should be in the extracted files)
- local binary
- if [ -f "$tmpdir/$BINARY_NAME" ]; then
- binary="$tmpdir/$BINARY_NAME"
- elif [ -f "$tmpdir/makima/$BINARY_NAME" ]; then
- binary="$tmpdir/makima/$BINARY_NAME"
- else
- # Search for the binary
- binary=$(find "$tmpdir" -name "$BINARY_NAME" -type f | head -1)
- if [ -z "$binary" ]; then
- print_error "Could not find $BINARY_NAME binary in archive"
- print_info "Archive contents:"
- ls -la "$tmpdir"
- rm -rf "$tmpdir"
- exit 1
- fi
- fi
-
- # Make binary executable
chmod +x "$binary"
- # Create install directory if it doesn't exist
+ # Create install directory if needed
if [ ! -d "$INSTALL_DIR" ]; then
print_info "Creating directory: $INSTALL_DIR"
if ! mkdir -p "$INSTALL_DIR" 2>/dev/null; then
@@ -177,14 +125,13 @@ install_binary() {
fi
fi
- # Install binary
+ # Install
print_info "Installing to: $INSTALL_DIR/$BINARY_NAME"
if ! mv "$binary" "$INSTALL_DIR/$BINARY_NAME" 2>/dev/null; then
print_warning "Cannot write to $INSTALL_DIR, trying with sudo..."
sudo mv "$binary" "$INSTALL_DIR/$BINARY_NAME"
fi
- # Cleanup
rm -rf "$tmpdir"
}
@@ -217,30 +164,19 @@ main() {
print_info "===================="
print_info ""
- # Check dependencies
check_dependencies
- # Detect platform
local os arch
os=$(detect_os)
arch=$(detect_arch)
print_info "Detected platform: $os-$arch"
- # Get latest version
- print_info "Fetching latest release..."
- local version
- version=$(get_latest_version)
- print_info "Latest version: $version"
-
- # Construct download URL
local url
- url=$(get_download_url "$version" "$os" "$arch")
+ url=$(get_download_url "$os" "$arch")
- # Download and install
print_info ""
install_binary "$url"
- # Verify
print_info ""
verify_installation