Skip to content

Commit afe2e1b

Browse files
feat: add general install scripts to static
1 parent e26eaa8 commit afe2e1b

2 files changed

Lines changed: 87 additions & 0 deletions

File tree

site/public/install

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# ANSI colors
5+
RED='\033[0;31m'
6+
GREEN='\033[0;32m'
7+
BLUE='\033[0;34m'
8+
NC='\033[0m' # No Color
9+
10+
info() {
11+
printf "${BLUE}==>${NC} $1\n"
12+
}
13+
14+
success() {
15+
printf "${GREEN}==>${NC} $1\n"
16+
}
17+
18+
error() {
19+
printf "${RED}Error:${NC} $1\n"
20+
exit 1
21+
}
22+
23+
# Check if uv is installed
24+
if ! command -v uv >/dev/null 2>&1; then
25+
info "uv is not installed. Installing uv..."
26+
curl -LsSf https://astral.sh/uv/install.sh | sh
27+
28+
# Try to source the cargo env if it exists (standard rust/uv install location)
29+
if [ -f "$HOME/.cargo/env" ]; then
30+
. "$HOME/.cargo/env"
31+
elif [ -f "$HOME/.local/bin/env" ]; then
32+
. "$HOME/.local/bin/env"
33+
else
34+
# Fallback: add common install paths to PATH for this session
35+
export PATH="$HOME/.cargo/bin:$HOME/.local/bin:$PATH"
36+
fi
37+
38+
if ! command -v uv >/dev/null 2>&1; then
39+
error "Failed to install uv or add it to PATH. Please install uv manually: https://docs.astral.sh/uv/getting-started/installation/"
40+
fi
41+
success "uv installed successfully"
42+
else
43+
info "uv is already installed"
44+
fi
45+
46+
# Run create-pywire-app
47+
info "Running create-pywire-app..."
48+
exec uvx create-pywire-app "$@"

site/public/install.ps1

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
$ErrorActionPreference = "Stop"
2+
3+
function Write-Info {
4+
param([string]$Message)
5+
Write-Host "==> $Message" -ForegroundColor Blue
6+
}
7+
8+
function Write-Success {
9+
param([string]$Message)
10+
Write-Host "==> $Message" -ForegroundColor Green
11+
}
12+
13+
# Check if uv is installed
14+
if (-not (Get-Command "uv" -ErrorAction SilentlyContinue)) {
15+
Write-Info "uv is not installed. Installing uv..."
16+
irm https://astral.sh/uv/install.ps1 | iex
17+
18+
# Refresh PATH from registry to see the new installation in the current session
19+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","User") + ";" + [System.Environment]::GetEnvironmentVariable("Path","Machine")
20+
21+
if (-not (Get-Command "uv" -ErrorAction SilentlyContinue)) {
22+
# Fallback check in default location if PATH update failed for some reason
23+
$uvPath = "$env:LOCALAPPDATA\programs\uv\uv.exe"
24+
if (Test-Path $uvPath) {
25+
# Add to current session path temporarily
26+
$env:Path = "$(Split-Path $uvPath);$env:Path"
27+
} else {
28+
Write-Error "Failed to install uv or find it in PATH. Please install uv manually: https://docs.astral.sh/uv/getting-started/installation/"
29+
exit 1
30+
}
31+
}
32+
Write-Success "uv installed successfully"
33+
} else {
34+
Write-Info "uv is already installed"
35+
}
36+
37+
# Run create-pywire-app
38+
Write-Info "Running create-pywire-app..."
39+
uvx create-pywire-app @args

0 commit comments

Comments
 (0)