Skip to content

Commit d8907bd

Browse files
committed
[ Add, Edit ] add installation scripts, summary update
1 parent 3013d2a commit d8907bd

File tree

3 files changed

+276
-48
lines changed

3 files changed

+276
-48
lines changed

README.md

Lines changed: 65 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -16,91 +16,108 @@ FlutterGuard CLI analyzes Flutter app APK files and extracts:
1616

1717
## Installation
1818

19-
### Option 1: Download Pre-Built Binary (Recommended)
19+
### Quick Install (Recommended)
2020

21-
The easiest way to get started is to download a pre-built binary from the releases page.
21+
**One-line install for Linux/macOS:**
2222

23-
**Step 1:** Go to the [Releases page](https://github.com/flutterguard/flutterguard-cli/releases) and download the binary for your system:
23+
```bash
24+
curl -sSL https://raw.githubusercontent.com/flutterguard/flutterguard-cli/main/install.sh | bash
25+
```
2426

25-
- **Linux (x64)**: `flutterguard-cli-linux-amd64`
26-
- **Linux (ARM64)**: `flutterguard-cli-linux-arm64`
27-
- **macOS (Intel)**: `flutterguard-cli-darwin-amd64`
28-
- **macOS (Apple Silicon)**: `flutterguard-cli-darwin-arm64`
29-
- **Windows (x64)**: `flutterguard-cli-windows-amd64.exe`
27+
**One-line install for Windows (PowerShell):**
3028

31-
**Step 2:** Install it on your system:
29+
```powershell
30+
irm https://raw.githubusercontent.com/flutterguard/flutterguard-cli/main/install.ps1 | iex
31+
```
3232

33-
**On Linux or macOS:**
33+
The script will automatically detect your OS/architecture, download the latest release, and install it to your PATH.
3434

35-
```bash
36-
# Download (replace with the URL for your platform)
37-
curl -LO https://github.com/flutterguard/flutterguard-cli/releases/latest/download/flutterguard-cli-linux-amd64
35+
---
3836

39-
# Rename to remove platform suffix
40-
mv flutterguard-cli-linux-amd64 flutterguard-cli
37+
### Manual Installation
4138

42-
# Make it executable
43-
chmod +x flutterguard-cli
39+
<details>
40+
<summary><b>Option 1: Download Pre-Built Binary</b></summary>
4441

45-
# Move to your PATH (optional, but convenient)
46-
sudo mv flutterguard-cli /usr/local/bin/
42+
**Step 1:** Download from [Releases](https://github.com/flutterguard/flutterguard-cli/releases/latest):
43+
44+
| Platform | Download Link |
45+
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
46+
| Linux (x64) | [flutterguard-cli-linux-amd64](https://github.com/flutterguard/flutterguard-cli/releases/latest/download/flutterguard-cli-linux-amd64) |
47+
| Linux (ARM64) | [flutterguard-cli-linux-arm64](https://github.com/flutterguard/flutterguard-cli/releases/latest/download/flutterguard-cli-linux-arm64) |
48+
| macOS (Intel) | [flutterguard-cli-darwin-amd64](https://github.com/flutterguard/flutterguard-cli/releases/latest/download/flutterguard-cli-darwin-amd64) |
49+
| macOS (Apple Silicon) | [flutterguard-cli-darwin-arm64](https://github.com/flutterguard/flutterguard-cli/releases/latest/download/flutterguard-cli-darwin-arm64) |
50+
| Windows (x64) | [flutterguard-cli-windows-amd64.exe](https://github.com/flutterguard/flutterguard-cli/releases/latest/download/flutterguard-cli-windows-amd64.exe) |
51+
52+
**Step 2:** Install it on your system:
53+
54+
**Linux/macOS:**
55+
56+
```bash
57+
# Make executable
58+
chmod +x flutterguard-cli-*
4759

48-
# Verify installation
60+
# Install to PATH
61+
sudo mv flutterguard-cli-* /usr/local/bin/flutterguard-cli
62+
63+
# Verify
4964
flutterguard-cli --version
5065
```
5166

52-
**On Windows:**
67+
**Windows:**
5368

54-
```powershell
55-
# Download from the releases page, then:
56-
# 1. Rename flutterguard-cli-windows-amd64.exe to flutterguard-cli.exe
57-
# 2. Move to a directory in your PATH (e.g., C:\Windows\System32)
58-
# 3. Or run directly from the download location
69+
1. Rename the downloaded file to `flutterguard-cli.exe`
70+
2. Move it to a directory in your PATH (e.g., `C:\Windows\System32`)
71+
3. Or keep it anywhere and add that directory to your PATH
5972

60-
# Verify installation
73+
```powershell
74+
# Verify
6175
flutterguard-cli.exe --version
6276
```
6377

64-
### Option 2: Build From Source
78+
</details>
6579

66-
If you have Go installed and want the latest features or to contribute to development:
80+
<details>
81+
<summary><b>Option 2: Build From Source</b></summary>
6782

6883
**Requirements:**
6984

70-
- Go 1.24 or higher ([Download Go](https://go.dev/dl/))
85+
- Go 1.24+ ([Download Go](https://go.dev/dl/))
7186
- Git
7287

73-
**Step 1:** Clone the repository
88+
**Steps:**
7489

7590
```bash
91+
# Clone the repository
7692
git clone https://github.com/flutterguard/flutterguard-cli.git
7793
cd flutterguard-cli
78-
```
7994

80-
**Step 2:** Build the binary
95+
# Build
96+
go build -o flutterguard-cli
8197

82-
```bash
83-
# Build for your current platform
84-
go build -o build/flutterguard-cli
98+
# Install (optional)
99+
sudo mv flutterguard-cli /usr/local/bin/
85100

86-
# The binary will be in the build/ directory
101+
# Verify
102+
flutterguard-cli --version
87103
```
88104

89-
**Step 3:** (Optional) Install to your PATH
105+
</details>
90106

91-
```bash
92-
# On Linux/macOS
93-
sudo cp build/flutterguard-cli /usr/local/bin/
107+
<details>
108+
<summary><b>Option 3: Package Managers</b> (Coming Soon)</summary>
94109

95-
# On Windows (run as Administrator)
96-
copy build\flutterguard-cli.exe C:\Windows\System32\
97-
```
110+
We're working on adding support for popular package managers:
98111

99-
**Step 4:** Verify the installation
112+
- **Homebrew** (macOS/Linux): `brew install flutterguard-cli`
113+
- **Snap** (Linux): `snap install flutterguard-cli`
114+
- **Chocolatey** (Windows): `choco install flutterguard-cli`
115+
- **AUR** (Arch Linux): `yay -S flutterguard-cli`
116+
- **Scoop** (Windows): `scoop install flutterguard-cli`
100117

101-
```bash
102-
flutterguard-cli --version
103-
```
118+
Stay tuned for updates!
119+
120+
</details>
104121

105122
### Optional Tools for Enhanced Analysis
106123

install.ps1

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/usr/bin/env pwsh
2+
$ErrorActionPreference = 'Stop'
3+
4+
$repo = "flutterguard/flutterguard-cli"
5+
$binaryName = "flutterguard-cli.exe"
6+
$installDir = "$env:LOCALAPPDATA\Programs\FlutterGuard"
7+
8+
Write-Host ""
9+
Write-Host "🔍 Detecting system..." -ForegroundColor Cyan
10+
Write-Host " OS: Windows" -ForegroundColor Gray
11+
Write-Host " Architecture: $env:PROCESSOR_ARCHITECTURE" -ForegroundColor Gray
12+
13+
# Determine architecture
14+
$arch = "amd64"
15+
if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") {
16+
$arch = "arm64"
17+
}
18+
19+
$downloadUrl = "https://github.com/$repo/releases/latest/download/flutterguard-cli-windows-$arch.exe"
20+
21+
Write-Host ""
22+
Write-Host "📥 Downloading FlutterGuard CLI..." -ForegroundColor Cyan
23+
Write-Host " From: $downloadUrl" -ForegroundColor Gray
24+
25+
try {
26+
# Download with progress
27+
$ProgressPreference = 'SilentlyContinue' # Faster downloads
28+
Invoke-WebRequest -Uri $downloadUrl -OutFile $binaryName -UseBasicParsing
29+
$ProgressPreference = 'Continue'
30+
Write-Host " ✓ Downloaded successfully" -ForegroundColor Green
31+
} catch {
32+
Write-Host ""
33+
Write-Host "❌ Download failed: $_" -ForegroundColor Red
34+
Write-Host " Please check:" -ForegroundColor Yellow
35+
Write-Host " 1. Your internet connection" -ForegroundColor Yellow
36+
Write-Host " 2. The release exists: https://github.com/$repo/releases/latest" -ForegroundColor Yellow
37+
exit 1
38+
}
39+
40+
Write-Host ""
41+
Write-Host "📦 Installing..." -ForegroundColor Cyan
42+
43+
# Create installation directory
44+
try {
45+
New-Item -ItemType Directory -Force -Path $installDir | Out-Null
46+
Move-Item -Force $binaryName "$installDir\$binaryName"
47+
Write-Host " ✓ Installed to $installDir" -ForegroundColor Green
48+
} catch {
49+
Write-Host " ⚠️ Failed to move to $installDir" -ForegroundColor Yellow
50+
Write-Host " Binary is in current directory: .\$binaryName" -ForegroundColor Yellow
51+
Write-Host ""
52+
Write-Host "To install manually:" -ForegroundColor Yellow
53+
Write-Host " Move-Item $binaryName $installDir\" -ForegroundColor Gray
54+
exit 0
55+
}
56+
57+
# Add to PATH if not already there
58+
Write-Host " Updating PATH..." -ForegroundColor Gray
59+
try {
60+
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
61+
if ($currentPath -notlike "*$installDir*") {
62+
[Environment]::SetEnvironmentVariable("Path", "$currentPath;$installDir", "User")
63+
Write-Host " ✓ Added to PATH (restart terminal to use)" -ForegroundColor Green
64+
$env:Path = "$env:Path;$installDir" # Update current session
65+
} else {
66+
Write-Host " ✓ Already in PATH" -ForegroundColor Green
67+
}
68+
} catch {
69+
Write-Host " ⚠️ Could not update PATH automatically" -ForegroundColor Yellow
70+
Write-Host " Please add manually: $installDir" -ForegroundColor Yellow
71+
}
72+
73+
# Verify installation
74+
Write-Host ""
75+
Write-Host "🎉 Installation complete!" -ForegroundColor Green
76+
Write-Host ""
77+
78+
try {
79+
$version = & "$installDir\$binaryName" --version 2>&1
80+
Write-Host "✓ Version: $version" -ForegroundColor Green
81+
} catch {
82+
Write-Host "✓ Installed to: $installDir\$binaryName" -ForegroundColor Green
83+
}
84+
85+
Write-Host ""
86+
Write-Host "Try it out:" -ForegroundColor Cyan
87+
Write-Host " flutterguard-cli --help" -ForegroundColor Gray
88+
Write-Host " flutterguard-cli --apk your-app.apk" -ForegroundColor Gray
89+
Write-Host ""
90+
Write-Host "Note: If command not found, restart your terminal or run:" -ForegroundColor Yellow
91+
Write-Host " `$env:Path = `"$env:Path;$installDir`"" -ForegroundColor Gray

install.sh

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
REPO="flutterguard/flutterguard-cli"
5+
BINARY_NAME="flutterguard-cli"
6+
INSTALL_DIR="/usr/local/bin"
7+
8+
# Colors for output
9+
RED='\033[0;31m'
10+
GREEN='\033[0;32m'
11+
YELLOW='\033[1;33m'
12+
NC='\033[0m' # No Color
13+
14+
# Detect OS and architecture
15+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
16+
ARCH=$(uname -m)
17+
18+
echo "🔍 Detecting system..."
19+
echo " OS: $OS"
20+
echo " Architecture: $ARCH"
21+
22+
# Map architecture to Go arch naming
23+
case "$ARCH" in
24+
x86_64) ARCH="amd64" ;;
25+
aarch64|arm64) ARCH="arm64" ;;
26+
armv7l) ARCH="arm" ;;
27+
i386|i686) ARCH="386" ;;
28+
*)
29+
echo -e "${RED}❌ Unsupported architecture: $ARCH${NC}"
30+
echo " Supported: x86_64, aarch64, arm64, armv7l, i386, i686"
31+
exit 1
32+
;;
33+
esac
34+
35+
# Check OS support
36+
case "$OS" in
37+
linux|darwin) ;;
38+
mingw*|msys*|cygwin*)
39+
echo -e "${RED}❌ Please use install.ps1 for Windows${NC}"
40+
echo " Run: irm https://raw.githubusercontent.com/$REPO/main/install.ps1 | iex"
41+
exit 1
42+
;;
43+
*)
44+
echo -e "${RED}❌ Unsupported OS: $OS${NC}"
45+
echo " Supported: Linux, macOS"
46+
exit 1
47+
;;
48+
esac
49+
50+
# Construct download URL
51+
DOWNLOAD_URL="https://github.com/$REPO/releases/latest/download/${BINARY_NAME}-${OS}-${ARCH}"
52+
53+
echo ""
54+
echo "📥 Downloading FlutterGuard CLI..."
55+
echo " From: $DOWNLOAD_URL"
56+
57+
# Download with progress
58+
if command -v curl &> /dev/null; then
59+
curl -fL --progress-bar "$DOWNLOAD_URL" -o "$BINARY_NAME" || {
60+
echo -e "${RED}❌ Download failed. Please check:${NC}"
61+
echo " 1. Your internet connection"
62+
echo " 2. The release exists: https://github.com/$REPO/releases/latest"
63+
exit 1
64+
}
65+
elif command -v wget &> /dev/null; then
66+
wget --show-progress -O "$BINARY_NAME" "$DOWNLOAD_URL" || {
67+
echo -e "${RED}❌ Download failed. Please check:${NC}"
68+
echo " 1. Your internet connection"
69+
echo " 2. The release exists: https://github.com/$REPO/releases/latest"
70+
exit 1
71+
}
72+
else
73+
echo -e "${RED}❌ Neither curl nor wget found. Please install one of them.${NC}"
74+
exit 1
75+
fi
76+
77+
# Make executable
78+
chmod +x "$BINARY_NAME"
79+
80+
echo ""
81+
echo "📦 Installing..."
82+
83+
# Try to install to /usr/local/bin
84+
if [ -w "$INSTALL_DIR" ]; then
85+
mv "$BINARY_NAME" "$INSTALL_DIR/"
86+
echo -e "${GREEN}✅ Installed to $INSTALL_DIR/$BINARY_NAME${NC}"
87+
elif command -v sudo &> /dev/null; then
88+
echo " (requires sudo for $INSTALL_DIR)"
89+
sudo mv "$BINARY_NAME" "$INSTALL_DIR/" || {
90+
echo -e "${YELLOW}⚠️ Failed to install to $INSTALL_DIR${NC}"
91+
echo " Binary is in current directory: ./$BINARY_NAME"
92+
echo " To install manually:"
93+
echo " sudo mv $BINARY_NAME $INSTALL_DIR/"
94+
exit 0
95+
}
96+
echo -e "${GREEN}✅ Installed to $INSTALL_DIR/$BINARY_NAME${NC}"
97+
else
98+
echo -e "${YELLOW}⚠️ Cannot write to $INSTALL_DIR and sudo not available${NC}"
99+
echo " Binary downloaded to: ./$BINARY_NAME"
100+
echo " To install manually:"
101+
echo " sudo mv $BINARY_NAME $INSTALL_DIR/"
102+
exit 0
103+
fi
104+
105+
# Verify installation
106+
echo ""
107+
echo "🎉 Installation complete!"
108+
echo ""
109+
110+
if command -v "$BINARY_NAME" &> /dev/null; then
111+
VERSION=$("$BINARY_NAME" --version 2>&1 || echo "unknown")
112+
echo -e "${GREEN}${NC} Version: $VERSION"
113+
echo ""
114+
echo "Try it out:"
115+
echo " $BINARY_NAME --help"
116+
echo " $BINARY_NAME --apk your-app.apk"
117+
else
118+
echo -e "${YELLOW}⚠️ Binary installed but not in PATH${NC}"
119+
echo " You may need to restart your terminal or add $INSTALL_DIR to PATH"
120+
fi

0 commit comments

Comments
 (0)