install.ps1: ask which drive to install to

Lists local fixed drives with free space and lets the player pick one by
number or letter. Enter keeps the previous location on the system drive
(%USERPROFILE%\mc-lan-party), so existing installs are still found;
other drives install to <drive>:\mc-lan-party. Warns under 3 GB free.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mykhailo Ivanchenko
2026-10-24 13:11:51 +02:00
parent ffdcf78133
commit 238aa7809c
2 changed files with 35 additions and 2 deletions
+1 -1
View File
@@ -131,7 +131,7 @@ Give participants:
- **Windows:** `irm https://git.mivanchenko.de/mivanchenko/mc-lan-party/raw/branch/main/install.ps1 | iex` - **Windows:** `irm https://git.mivanchenko.de/mivanchenko/mc-lan-party/raw/branch/main/install.ps1 | iex`
- **Linux / macOS:** `curl -fsSL https://git.mivanchenko.de/mivanchenko/mc-lan-party/raw/branch/main/install.sh | bash` - **Linux / macOS:** `curl -fsSL https://git.mivanchenko.de/mivanchenko/mc-lan-party/raw/branch/main/install.sh | bash`
Each script asks for a nickname, derives a stable offline-mode UUID from it (so the same name = same player data across the whole 3-day party, even if they re-run the script), seeds that into a fresh `accounts.json`, downloads Fjord Launcher Unlocked from GitHub and the modpack from `https://minecraft.mivanchenko.de/modpack.zip`, and launches straight into the instance already connected to the same server. On Windows, `install.ps1` first asks which local drive to install to (Enter keeps the old default, `%USERPROFILE%\mc-lan-party`; any other drive installs to `<drive>:\mc-lan-party`). Each script then asks for a nickname, derives a stable offline-mode UUID from it (so the same name = same player data across the whole 3-day party, even if they re-run the script), seeds that into a fresh `accounts.json`, downloads Fjord Launcher Unlocked from GitHub and the modpack from `https://minecraft.mivanchenko.de/modpack.zip`, and launches straight into the instance already connected to the same server.
Make sure your Minecraft server itself is running with `online-mode=false` in `server.properties` — offline accounts only work against offline-mode servers. Make sure your Minecraft server itself is running with `online-mode=false` in `server.properties` — offline accounts only work against offline-mode servers.
+33
View File
@@ -14,7 +14,40 @@ $ServerAddr = "minecraft.mivanchenko.de:25565" # always-on homelab box, same
$ErrorActionPreference = "Stop" # fail loudly instead of printing an error and silently continuing $ErrorActionPreference = "Stop" # fail loudly instead of printing an error and silently continuing
# ---- pick the install drive (default: the system drive, under the user profile like before) ----
$SystemDrive = $env:SystemDrive # e.g. "C:"
$Drives = @(Get-CimInstance Win32_LogicalDisk -Filter "DriveType=3" | Sort-Object DeviceID) # local fixed disks only
Write-Host "Where should the LAN party Minecraft be installed? (needs ~3 GB)"
for ($i = 0; $i -lt $Drives.Count; $i++) {
$d = $Drives[$i]
$free = [math]::Round($d.FreeSpace / 1GB, 1)
$label = if ($d.VolumeName) { " ($($d.VolumeName))" } else { "" }
$default = if ($d.DeviceID -eq $SystemDrive) { " [default]" } else { "" }
Write-Host (" {0}) {1}{2} - {3} GB free{4}" -f ($i + 1), $d.DeviceID, $label, $free, $default)
}
$DriveChoice = $null
while (-not $DriveChoice) {
$answer = Read-Host "Drive number or letter [$SystemDrive]"
if ([string]::IsNullOrWhiteSpace($answer)) { $answer = $SystemDrive }
$answer = $answer.Trim()
if ($answer -match '^\d+$' -and [int]$answer -ge 1 -and [int]$answer -le $Drives.Count) {
$DriveChoice = $Drives[[int]$answer - 1]
} else {
$letter = $answer.TrimEnd(':', '\').ToUpper() + ":"
$DriveChoice = $Drives | Where-Object { $_.DeviceID -eq $letter } | Select-Object -First 1
}
if (-not $DriveChoice) { Write-Host " '$answer' is not one of the drives above, try again." -ForegroundColor Yellow }
}
if ($DriveChoice.FreeSpace -lt 3GB) {
Write-Host "==> Warning: only $([math]::Round($DriveChoice.FreeSpace / 1GB, 1)) GB free on $($DriveChoice.DeviceID), the install may run out of space." -ForegroundColor Yellow
}
# System drive keeps the old location so existing installs are found again; other drives get a top-level folder
if ($DriveChoice.DeviceID -eq $SystemDrive) {
$InstallDir = Join-Path $env:USERPROFILE "mc-lan-party" $InstallDir = Join-Path $env:USERPROFILE "mc-lan-party"
} else {
$InstallDir = Join-Path "$($DriveChoice.DeviceID)\" "mc-lan-party"
}
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
Set-Location $InstallDir Set-Location $InstallDir