From 238aa7809c199ffd08d12d3c350e1cab6bd41126 Mon Sep 17 00:00:00 2001 From: Mykhailo Ivanchenko Date: Sat, 24 Oct 2026 13:11:51 +0200 Subject: [PATCH] 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 :\mc-lan-party. Warns under 3 GB free. Co-Authored-By: Claude Opus 5.5 --- HOSTING.md | 2 +- install.ps1 | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/HOSTING.md b/HOSTING.md index 7479c14..fe4fae4 100644 --- a/HOSTING.md +++ b/HOSTING.md @@ -131,7 +131,7 @@ Give participants: - **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` -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 `:\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. diff --git a/install.ps1 b/install.ps1 index 6feed21..d03c5c0 100644 --- a/install.ps1 +++ b/install.ps1 @@ -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 -$InstallDir = Join-Path $env:USERPROFILE "mc-lan-party" +# ---- 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" +} else { + $InstallDir = Join-Path "$($DriveChoice.DeviceID)\" "mc-lan-party" +} New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null Set-Location $InstallDir