Renamed Manager.ps1 to Manager-Windows.ps1 and reverted back to remove Linux support.

This commit is contained in:
Yuuki Chan 2023-03-18 19:39:44 +09:00
parent 4e06e4e496
commit 23f60dbecb

View file

@ -58,8 +58,6 @@ function check_software ($app)
}
}
function check_ram ($in)
{
if ($IsWindows)
{
$total = (Get-CimInstance Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum /1gb
@ -73,16 +71,6 @@ function check_ram ($in)
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
{
$arch = (Get-CimInstance CIM_OperatingSystem).OSArchitecture
@ -98,8 +86,6 @@ function check_arch
}
}
function check_os
{
if ($IsWindows)
{
$win10 = "Microsoft Windows 10"
$win11 = "Microsoft Windows 11"
@ -115,26 +101,16 @@ function check_os
success "$win10 detected."
$global:check += 1
}
}
elseif ($IsMacOS)
{
error "Operating System is not supported yet."
}
elseif ($IsLinux)
{
success "Linux detected."
$global:check += 1
}
else
{
error "Couldn't detect Operating System."
error "Operating System is not supported."
}
}
function getkey
{
$exists = Test-Path -Path ".\longvinter-windows-server\Longvinter\Saved\Logs\Longvinter.log" -PathType Leaf
if ($exists)
IF ($exists)
{
Write-Host (Select-String -Pattern "'[0-9a-f]{32}" -Path ".\longvinter-windows-server\Longvinter\Saved\Logs\Longvinter.log").Matches.groups[0].value.ToString().Replace("'", "") -NoNewline -ForegroundColor Green
}
@ -193,21 +169,19 @@ function uninstall
# Handle commandline arguments
if ($args.Count -eq 1)
{
$arg = $args[0].ToString().ToLower()
if ($arg -eq "getkey")
if ($args[0].ToString().ToLower() -eq "getkey")
{
getkey
}
elseif ($arg -eq "update")
elseif ($args[0].ToString().ToLower() -eq "update")
{
update
}
elseif ($arg -eq "backup")
elseif ($args[0].ToString().ToLower() -eq "backup")
{
backup
}
elseif ($arg -eq "uninstall")
elseif ($args[0].ToString().ToLower() -eq "uninstall")
{
Write-Host "Uninstalling the server will delete everything in this folder, including backups."
$answer = Read-Host "> Are you sure you want to uninstall the server? y/n"
@ -229,8 +203,6 @@ check_ram(3) # argument is amount of (required) RAM in GB.
check_arch
check_os
if ($IsWindows)
{
if ($check -eq 6)
{
Write-Host "Cloning Longvinter Windows Server repository..."
@ -288,18 +260,6 @@ if ($IsWindows)
}
else
{
Write-Host "One or more checks failed. Cannot install Longvinter (Windows) Server."
Write-Host "One or more checks failed. Cannot install Longvinter Server."
Exit
}
}
elseif ($IsLinux)
{
if ((id -u) -eq 0)
{
}
else
{
error "Please run the script as root."
}
}