Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 40 additions & 9 deletions bin/spark-http-proxy
Original file line number Diff line number Diff line change
Expand Up @@ -400,17 +400,48 @@ install_mkcert() {
return 0
fi

if ! command -v brew >/dev/null 2>&1; then
log_error "mkcert not found and Homebrew not available for installation"
# Try different package managers based on availability
if command -v brew >/dev/null 2>&1; then
log_info "Installing mkcert with Homebrew..."
if brew install mkcert nss && mkcert -install; then
log_success "mkcert installed successfully"
return 0
else
log_error "Failed to install mkcert with Homebrew"
return 1
fi
elif command -v pacman >/dev/null 2>&1; then
log_info "Installing mkcert with pacman..."
log_info "Please run: sudo pacman -S mkcert"
log_error "Automatic installation with pacman requires sudo privileges"
log_info "After installation, run the command again"
return 1
elif command -v apt >/dev/null 2>&1; then
log_info "Installing mkcert with apt..."
log_info "Please run: sudo apt install mkcert"
log_error "Automatic installation with apt requires sudo privileges"
log_info "After installation, run the command again"
return 1
elif command -v yum >/dev/null 2>&1; then
log_info "Installing mkcert with yum..."
log_info "Please run: sudo yum install mkcert"
log_error "Automatic installation with yum requires sudo privileges"
log_info "After installation, run the command again"
return 1
elif command -v dnf >/dev/null 2>&1; then
log_info "Installing mkcert with dnf..."
log_info "Please run: sudo dnf install mkcert"
log_error "Automatic installation with dnf requires sudo privileges"
log_info "After installation, run the command again"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep Brew and Pacman, as they are the only distributions we support now.
For arch we neeed to install both packages: pacman -S nss mkcert

As we do for brew, we can actually run the command instead of just printing.

@stefanomainardi

return 1
fi

log_info "Installing mkcert with Homebrew..."
if brew install mkcert nss && mkcert -install; then
log_success "mkcert installed successfully"
return 0
else
log_error "Failed to install mkcert"
log_error "mkcert not found and no supported package manager available"
log_info "Please install mkcert manually:"
log_info " - Arch Linux: sudo pacman -S mkcert"
log_info " - Ubuntu/Debian: sudo apt install mkcert"
log_info " - CentOS/RHEL: sudo yum install mkcert"
log_info " - Fedora: sudo dnf install mkcert"
log_info " - macOS: brew install mkcert"
return 1
fi
}
Expand Down