Skip to content

Commit 60c919b

Browse files
committed
fix(install): update install script to download AppImage directly
- Install script now downloads AppImage to ~/.openlinear/openlinear.AppImage - This is where the npm package expects to find the desktop app - Fixes GitHub OAuth redirect issue by installing the actual desktop app
1 parent a249a51 commit 60c919b

File tree

1 file changed

+37
-116
lines changed

1 file changed

+37
-116
lines changed

apps/landing/public/install.sh

Lines changed: 37 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,90 @@
11
#!/bin/bash
2-
# OpenLinear Installer Script
2+
# OpenLinear Desktop App Installer
33
# Usage: curl -fsSL https://rixie.in/api/install | bash
44

55
set -e
66

7-
# Colors
8-
RED='\033[0;31m'
9-
GREEN='\033[0;32m'
10-
BLUE='\033[0;34m'
11-
YELLOW='\033[1;33m'
12-
NC='\033[0m' # No Color
13-
14-
# Configuration
157
REPO="kaizen403/openlinear"
168
API_URL="https://api.github.com/repos/${REPO}/releases/latest"
17-
INSTALL_DIR="${HOME}/.local/bin"
18-
BIN_NAME="openlinear"
9+
INSTALL_DIR="${HOME}/.openlinear"
10+
BINARY_NAME="openlinear.AppImage"
1911

20-
echo -e "${BLUE}OpenLinear Installer${NC}"
12+
echo "OpenLinear Installer"
2113
echo "===================="
2214
echo ""
2315

24-
# Detect OS and architecture
25-
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
16+
OS=$(uname -s)
2617
ARCH=$(uname -m)
2718

28-
case "$OS" in
29-
linux)
30-
case "$ARCH" in
31-
x86_64) PLATFORM="linux-x64" ;;
32-
aarch64|arm64) PLATFORM="linux-arm64" ;;
33-
*) echo -e "${RED}Unsupported architecture: $ARCH${NC}"; exit 1 ;;
34-
esac
35-
;;
36-
darwin)
37-
case "$ARCH" in
38-
x86_64) PLATFORM="macos-x64" ;;
39-
arm64) PLATFORM="macos-arm64" ;;
40-
*) echo -e "${RED}Unsupported architecture: $ARCH${NC}"; exit 1 ;;
41-
esac
42-
;;
43-
*)
44-
echo -e "${RED}Unsupported OS: $OS${NC}"
45-
exit 1
46-
;;
19+
if [ "$OS" != "Linux" ]; then
20+
echo "Error: OpenLinear desktop app is currently only available for Linux"
21+
echo "Your OS: $OS"
22+
exit 1
23+
fi
24+
25+
case "$ARCH" in
26+
x86_64) PLATFORM="amd64" ;;
27+
aarch64|arm64) PLATFORM="arm64" ;;
28+
*) echo "Error: Unsupported architecture: $ARCH"; exit 1 ;;
4729
esac
4830

49-
echo -e "Detected: ${YELLOW}$PLATFORM${NC}"
31+
echo "Detected: Linux $PLATFORM"
5032
echo ""
5133

52-
# Check for required tools
5334
if ! command -v curl &> /dev/null && ! command -v wget &> /dev/null; then
54-
echo -e "${RED}Error: curl or wget is required${NC}"
35+
echo "Error: curl or wget is required"
5536
exit 1
5637
fi
5738

58-
# Get latest release
39+
echo "Fetching latest release..."
40+
5941
if command -v curl &> /dev/null; then
6042
RELEASE_DATA=$(curl -s "$API_URL")
6143
else
6244
RELEASE_DATA=$(wget -qO- "$API_URL")
6345
fi
6446

6547
if [ -z "$RELEASE_DATA" ] || echo "$RELEASE_DATA" | grep -q "Not Found"; then
66-
echo -e "${RED}Error: Failed to fetch release information${NC}"
48+
echo "Error: Failed to fetch release information"
6749
exit 1
6850
fi
6951

70-
# Parse version
7152
VERSION=$(echo "$RELEASE_DATA" | grep -o '"tag_name": "[^"]*"' | cut -d'"' -f4)
7253
if [ -z "$VERSION" ]; then
73-
echo -e "${RED}Error: Failed to parse version${NC}"
54+
echo "Error: Failed to parse version"
7455
exit 1
7556
fi
7657

77-
echo -e "Latest version: ${GREEN}$VERSION${NC}"
58+
echo "Latest version: $VERSION"
7859
echo ""
7960

80-
# Find asset URL
81-
ASSET_PATTERN="${PLATFORM}"
82-
ASSET_URL=$(echo "$RELEASE_DATA" | grep -o '"browser_download_url": "[^"]*' | grep "$ASSET_PATTERN" | head -1 | cut -d'"' -f4)
61+
ASSET_URL=$(echo "$RELEASE_DATA" | grep -o '"browser_download_url": "[^"]*\.AppImage"' | grep -i "linux.*${PLATFORM}\|${PLATFORM}.*linux\|appimage" | head -1 | cut -d'"' -f4)
8362

8463
if [ -z "$ASSET_URL" ]; then
85-
echo -e "${YELLOW}No prebuilt binary found for $PLATFORM${NC}"
86-
echo "Falling back to npm installation..."
87-
echo ""
88-
89-
if ! command -v npm &> /dev/null; then
90-
echo -e "${RED}Error: npm is not installed${NC}"
91-
echo "Please install Node.js first: https://nodejs.org"
92-
exit 1
93-
fi
94-
95-
echo -e "${BLUE}Installing via npm...${NC}"
96-
npm install -g openlinear
97-
98-
if command -v openlinear &> /dev/null; then
99-
echo ""
100-
echo -e "${GREEN}✓ OpenLinear installed successfully!${NC}"
101-
echo ""
102-
echo "Run 'openlinear --help' to get started"
103-
else
104-
echo -e "${RED}Error: Installation failed${NC}"
105-
exit 1
106-
fi
107-
108-
exit 0
109-
fi
110-
111-
echo -e "${BLUE}Downloading...${NC}"
112-
113-
# Create temp directory
114-
TMP_DIR=$(mktemp -d)
115-
trap "rm -rf $TMP_DIR" EXIT
116-
117-
# Download
118-
DOWNLOAD_FILE="$TMP_DIR/openlinear-${PLATFORM}.tar.gz"
119-
120-
if command -v curl &> /dev/null; then
121-
curl -fsSL "$ASSET_URL" -o "$DOWNLOAD_FILE" --progress-bar
122-
else
123-
wget -q --show-progress "$ASSET_URL" -O "$DOWNLOAD_FILE"
64+
echo "Error: No AppImage found for Linux $PLATFORM"
65+
exit 1
12466
fi
12567

68+
echo "Downloading OpenLinear..."
12669
echo ""
127-
echo -e "${BLUE}Extracting...${NC}"
12870

129-
# Extract
130-
tar -xzf "$DOWNLOAD_FILE" -C "$TMP_DIR"
131-
132-
# Install
13371
mkdir -p "$INSTALL_DIR"
13472

135-
# Find the binary in extracted files
136-
if [ -f "$TMP_DIR/openlinear" ]; then
137-
BINARY_PATH="$TMP_DIR/openlinear"
138-
elif [ -f "$TMP_DIR/openlinear-desktop" ]; then
139-
BINARY_PATH="$TMP_DIR/openlinear-desktop"
73+
if command -v curl &> /dev/null; then
74+
curl -fsSL "$ASSET_URL" -o "$INSTALL_DIR/$BINARY_NAME" --progress-bar
14075
else
141-
BINARY_PATH=$(find "$TMP_DIR" -type f -executable | head -1)
76+
wget -q --show-progress "$ASSET_URL" -O "$INSTALL_DIR/$BINARY_NAME"
14277
fi
14378

144-
cp "$BINARY_PATH" "$INSTALL_DIR/$BIN_NAME"
145-
chmod +x "$INSTALL_DIR/$BIN_NAME"
146-
147-
# Check if install dir is in PATH
148-
if [[ ":$PATH:" != *":$INSTALL_DIR:"* ]]; then
149-
echo ""
150-
echo -e "${YELLOW}Warning: $INSTALL_DIR is not in your PATH${NC}"
151-
echo ""
152-
echo "Add the following to your shell profile (~/.bashrc, ~/.zshrc, etc.):"
153-
echo ""
154-
echo " export PATH=\"\$PATH:$INSTALL_DIR\""
155-
echo ""
156-
fi
79+
chmod +x "$INSTALL_DIR/$BINARY_NAME"
15780

15881
echo ""
159-
echo -e "${GREEN}✓ OpenLinear $VERSION installed successfully!${NC}"
82+
echo "✓ OpenLinear $VERSION installed successfully!"
16083
echo ""
161-
echo "Location: $INSTALL_DIR/$BIN_NAME"
84+
echo "Location: $INSTALL_DIR/$BINARY_NAME"
16285
echo ""
163-
164-
if command -v openlinear &> /dev/null; then
165-
echo "Run 'openlinear --help' to get started"
166-
else
167-
echo "Please restart your terminal or run:"
168-
echo " export PATH=\"\$PATH:$INSTALL_DIR\""
169-
fi
86+
echo "Run OpenLinear with:"
87+
echo " $INSTALL_DIR/$BINARY_NAME"
88+
echo ""
89+
echo "Or install the npm wrapper for easier access:"
90+
echo " npm install -g openlinear"

0 commit comments

Comments
 (0)