mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
[skipci]chores: Added one line install scripts
This commit is contained in:
commit
ec53f53f42
4 changed files with 229 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -436,3 +436,4 @@ FodyWeavers.xsd
|
|||
# SpecStory files
|
||||
/.specstory/
|
||||
/.vscode/settings.json
|
||||
/Sentry/
|
||||
|
|
|
|||
85
docs/.vuepress/public/install.ps1
Normal file
85
docs/.vuepress/public/install.ps1
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
# Minecraft Console Client - Installer for Windows
|
||||
# Downloads the latest MinecraftClient binary for your Windows architecture.
|
||||
# Usage (PowerShell): iwr -useb https://mccteam.github.io/install.ps1 | iex
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$REPO = "MCCTeam/Minecraft-Console-Client"
|
||||
$OUTPUT = "MinecraftClient.exe"
|
||||
|
||||
# --- Detect CPU architecture ---
|
||||
$arch = [System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture
|
||||
$archId = switch ($arch) {
|
||||
'X64' { 'x64' }
|
||||
'X86' { 'x86' }
|
||||
'Arm64' { 'arm64' }
|
||||
default {
|
||||
Write-Error "Unsupported CPU architecture: $arch"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
$suffix = "win-$archId"
|
||||
|
||||
# --- Fetch latest release metadata from GitHub API ---
|
||||
$apiUrl = "https://api.github.com/repos/$REPO/releases/latest"
|
||||
Write-Host "Fetching latest release information..."
|
||||
$release = Invoke-RestMethod -Uri $apiUrl -UseBasicParsing
|
||||
|
||||
# --- Locate the correct asset ---
|
||||
$asset = $release.assets | Where-Object { $_.name -match "^MinecraftClient-.*-$([regex]::Escape($suffix))\.exe$" } | Select-Object -First 1
|
||||
|
||||
if (-not $asset) {
|
||||
Write-Error "Could not find a release asset for '$suffix'."
|
||||
exit 1
|
||||
}
|
||||
|
||||
$downloadUrl = $asset.browser_download_url
|
||||
$tag = $release.tag_name
|
||||
|
||||
Write-Host "Downloading MinecraftClient $tag ($suffix)..."
|
||||
|
||||
# Download with a built-in ASCII progress bar (no external tools required).
|
||||
# HttpWebRequest streams the body on the main thread so we can update the
|
||||
# progress bar inline without any Runspace or thread-safety concerns.
|
||||
$outPath = Join-Path (Get-Location).Path $OUTPUT
|
||||
$request = [System.Net.HttpWebRequest]::Create($downloadUrl)
|
||||
$response = $request.GetResponse()
|
||||
$totalBytes = $response.ContentLength
|
||||
|
||||
$responseStream = $response.GetResponseStream()
|
||||
$fileStream = [System.IO.File]::Create($outPath)
|
||||
$buffer = New-Object byte[] 32768
|
||||
$totalRead = 0
|
||||
|
||||
try {
|
||||
while ($true) {
|
||||
$read = $responseStream.Read($buffer, 0, $buffer.Length)
|
||||
if ($read -le 0) { break }
|
||||
$fileStream.Write($buffer, 0, $read)
|
||||
$totalRead += $read
|
||||
if ($totalBytes -gt 0) {
|
||||
$pct = [int]($totalRead * 100 / $totalBytes)
|
||||
$filled = '=' * [int]($pct / 2)
|
||||
$bar = $filled.PadRight(50)
|
||||
$recv = [math]::Round($totalRead / 1MB, 1)
|
||||
$total = [math]::Round($totalBytes / 1MB, 1)
|
||||
# Use [Console]::Write with an explicit \r so the cursor returns to
|
||||
# column 0 and overwrites the previous bar. Write-Host -NoNewline
|
||||
# does not reliably reposition the cursor when the script is run
|
||||
# via iex (pipe mode), producing multiple bars on one line.
|
||||
$line = "`r[{0}] {1,3}% {2,6:N1} / {3,6:N1} MB" -f $bar, $pct, $recv, $total
|
||||
[Console]::Write($line)
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
$fileStream.Close()
|
||||
$responseStream.Close()
|
||||
$response.Close()
|
||||
}
|
||||
|
||||
[Console]::WriteLine() # end the progress line
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Downloaded: .\$OUTPUT"
|
||||
Write-Host "Run with: .\$OUTPUT --help"
|
||||
106
docs/.vuepress/public/install.sh
Normal file
106
docs/.vuepress/public/install.sh
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
#!/bin/sh
|
||||
# Minecraft Console Client - Installer
|
||||
# Downloads the latest MinecraftClient binary for your Linux or macOS platform.
|
||||
# Usage: curl -fsSL https://mccteam.github.io/install.sh | sh
|
||||
# or: wget -qO- https://mccteam.github.io/install.sh | sh
|
||||
|
||||
set -e
|
||||
|
||||
REPO="MCCTeam/Minecraft-Console-Client"
|
||||
OUTPUT="MinecraftClient"
|
||||
|
||||
# --- Detect OS ---
|
||||
OS=$(uname -s)
|
||||
case "$OS" in
|
||||
Linux) PLATFORM="linux" ;;
|
||||
Darwin) PLATFORM="osx" ;;
|
||||
*)
|
||||
echo "Error: Unsupported OS '$OS'. This script supports Linux and macOS." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# --- Detect CPU architecture ---
|
||||
ARCH=$(uname -m)
|
||||
case "$ARCH" in
|
||||
x86_64|amd64) ARCH_ID="x64" ;;
|
||||
aarch64|arm64) ARCH_ID="arm64" ;;
|
||||
armv7l|armv8l|armhf) ARCH_ID="arm" ;;
|
||||
arm*) ARCH_ID="arm" ;;
|
||||
*)
|
||||
echo "Error: Unsupported CPU architecture '$ARCH'." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# macOS does not have an arm (32-bit) build
|
||||
if [ "$PLATFORM" = "osx" ] && [ "$ARCH_ID" = "arm" ]; then
|
||||
echo "Error: 32-bit ARM is not supported on macOS." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SUFFIX="${PLATFORM}-${ARCH_ID}"
|
||||
|
||||
# --- Download helpers: prefer curl, fall back to wget ---
|
||||
_download_stdout() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL "$1"
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
wget -qO- "$1"
|
||||
else
|
||||
echo "Error: Neither 'curl' nor 'wget' is available. Please install one and retry." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
_download_file() {
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fL --progress-bar -o "$2" "$1"
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
# --show-progress forces the progress bar even when stdout is not a TTY.
|
||||
# Fall back silently to default output if the flag is not supported
|
||||
# (older wget versions, e.g. BusyBox wget).
|
||||
if wget --show-progress -O "$2" "$1" 2>/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
wget -O "$2" "$1"
|
||||
else
|
||||
echo "Error: Neither 'curl' nor 'wget' is available. Please install one and retry." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# --- Fetch latest release metadata from GitHub API ---
|
||||
API_URL="https://api.github.com/repos/${REPO}/releases/latest"
|
||||
echo "Fetching latest release information..."
|
||||
RELEASE_JSON=$(_download_stdout "$API_URL")
|
||||
|
||||
# --- Parse asset download URL (no external tools required) ---
|
||||
# The JSON key "browser_download_url" appears once per asset.
|
||||
# We match the key followed by the URL, anchoring on the platform-arch suffix
|
||||
# and the closing quote so that e.g. "linux-arm" does not match "linux-arm64".
|
||||
# The ' *: *' pattern handles optional spaces around the colon (GitHub API adds spaces).
|
||||
ASSET_URL=$(printf '%s' "$RELEASE_JSON" \
|
||||
| grep -o '"browser_download_url" *: *"[^"]*-'"${SUFFIX}"'"' \
|
||||
| grep -o 'https://[^"]*' \
|
||||
| head -1)
|
||||
|
||||
if [ -z "$ASSET_URL" ]; then
|
||||
echo "Error: Could not find a release asset for platform '${SUFFIX}'." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Extract tag name for display ---
|
||||
TAG=$(printf '%s' "$RELEASE_JSON" \
|
||||
| grep -o '"tag_name" *: *"[^"]*"' \
|
||||
| head -1 \
|
||||
| grep -o '"[^"]*"$' \
|
||||
| tr -d '"')
|
||||
|
||||
echo "Downloading MinecraftClient ${TAG} (${SUFFIX})..."
|
||||
_download_file "$ASSET_URL" "$OUTPUT"
|
||||
chmod +x "$OUTPUT"
|
||||
|
||||
echo ""
|
||||
echo "Downloaded: ./${OUTPUT}"
|
||||
echo "Run with: ./${OUTPUT} --help"
|
||||
|
|
@ -4,6 +4,7 @@ title: Installation
|
|||
|
||||
# Installation
|
||||
|
||||
- [Quick Install (one-liner)](#quick-install)
|
||||
- [YouTube Tutorials](#youtube-tutorials)
|
||||
- [Download a compiled binary](#download-a-compiled-binary)
|
||||
- [Building from the source code](#building-from-the-source-code)
|
||||
|
|
@ -11,6 +12,42 @@ title: Installation
|
|||
- [Run on Android](#run-on-android)
|
||||
- [Run MCC 24/7 on a VPS](#run-on-a-vps)
|
||||
|
||||
## Quick Install
|
||||
|
||||
The quickest way to get MCC is to run the installer script for your platform. It auto-detects your OS and CPU architecture, fetches the latest release from GitHub, and saves the binary to your current directory.
|
||||
|
||||
### Linux / macOS
|
||||
|
||||
Open a terminal in the folder where you want MCC and run:
|
||||
|
||||
```bash
|
||||
curl -fsSL https://mccteam.github.io/install.sh | sh
|
||||
```
|
||||
|
||||
If you prefer `wget`:
|
||||
|
||||
```bash
|
||||
wget -qO- https://mccteam.github.io/install.sh | sh
|
||||
```
|
||||
|
||||
The script downloads `MinecraftClient` and marks it executable. Supported architectures: `x64`, `arm64`, `arm` (Linux only).
|
||||
|
||||
### Windows
|
||||
|
||||
Open **PowerShell** in the folder where you want MCC and run:
|
||||
|
||||
```powershell
|
||||
iwr -useb https://mccteam.github.io/install.ps1 | iex
|
||||
```
|
||||
|
||||
The script downloads `MinecraftClient.exe`. Supported architectures: `x64`, `x86`, `arm64`.
|
||||
|
||||
::: tip
|
||||
You can also download the scripts directly and inspect them before running:
|
||||
- Linux/macOS: [install.sh](https://mccteam.github.io/install.sh)
|
||||
- Windows: [install.ps1](https://mccteam.github.io/install.ps1)
|
||||
:::
|
||||
|
||||
## YouTube Tutorials
|
||||
|
||||
If you're not the kind of person that likes textual tutorials, our community has made video tutorials available on YouTube.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue