Updated Manager.ps1 - more Linux support, still Work In Progress.

This commit is contained in:
Yuuki Chan 2023-03-06 18:58:06 +09:00
parent bd9d97f6d8
commit 4e06e4e496

View file

@ -59,6 +59,8 @@ function check_software ($app)
} }
function check_ram ($in) function check_ram ($in)
{ {
if ($IsWindows)
{
$total = (Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum /1gb $total = (Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum /1gb
if ($total -gt $in) if ($total -gt $in)
@ -70,6 +72,16 @@ function check_ram ($in)
{ {
error "$in GB RAM detected. You need at least 3 GB." error "$in GB RAM detected. You need at least 3 GB."
} }
}
elseif ($IsLinux)
{
$total = $(awk '{ print $2 }' /proc/meminfo | head -n1) / 1024 / 1024
if ($total -lt 2.79369)
{
error "Not enough RAM installed. You need AT LEAST 3GB."
}
}
} }
function check_arch function check_arch
{ {
@ -217,8 +229,10 @@ check_ram(3) # argument is amount of (required) RAM in GB.
check_arch check_arch
check_os check_os
if ($check -eq 6) if ($IsWindows)
{ {
if ($check -eq 6)
{
Write-Host "Cloning Longvinter Windows Server repository..." Write-Host "Cloning Longvinter Windows Server repository..."
git clone -q https://github.com/Uuvana-Studios/longvinter-windows-server.git git clone -q https://github.com/Uuvana-Studios/longvinter-windows-server.git
@ -230,19 +244,19 @@ if ($check -eq 6)
else else
{ {
Set-Content -Path ".\longvinter-windows-server\Longvinter\Saved\Config\WindowsServer\Game.ini" -Value "[/game/blueprints/server/gi_advancedsessions.gi_advancedsessions_c] Set-Content -Path ".\longvinter-windows-server\Longvinter\Saved\Config\WindowsServer\Game.ini" -Value "[/game/blueprints/server/gi_advancedsessions.gi_advancedsessions_c]
ServerName=Unnamed Island ServerName=Unnamed Island
ServerTag=Default ServerTag=Default
MaxPlayers=32 MaxPlayers=32
ServerMOTD=Welcome to Longvinter Island! ServerMOTD=Welcome to Longvinter Island!
Password= Password=
CommunityWebsite=www.longvinter.com CommunityWebsite=www.longvinter.com
[/game/blueprints/server/gm_longvinter.gm_longvinter_c] [/game/blueprints/server/gm_longvinter.gm_longvinter_c]
AdminEosID=97615967659669198 AdminEosID=97615967659669198
PVP=true PVP=true
TentDecay=true TentDecay=true
MaxTents=2 MaxTents=2
ChestRespawnTime=600" ChestRespawnTime=600"
} }
Write-Host "> It is suggested to edit the Game.ini to your liking." Write-Host "> It is suggested to edit the Game.ini to your liking."
@ -271,9 +285,21 @@ ChestRespawnTime=600"
$Host.UI.ReadLine() $Host.UI.ReadLine()
Write-Host "" Write-Host ""
Write-Host "You can now run the shortcut in the current directory." Write-Host "You can now run the shortcut in the current directory."
} }
else else
{ {
Write-Host "One or more checks failed. Cannot install Longvinter Server." Write-Host "One or more checks failed. Cannot install Longvinter (Windows) Server."
Exit Exit
}
}
elseif ($IsLinux)
{
if ((id -u) -eq 0)
{
}
else
{
error "Please run the script as root."
}
} }