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