Updated Manager.ps1 with W.I.P. Linux support.
This commit is contained in:
parent
b0302f8950
commit
bd9d97f6d8
1 changed files with 29 additions and 15 deletions
44
Manager.ps1
44
Manager.ps1
|
@ -87,30 +87,42 @@ function check_arch
|
|||
}
|
||||
function check_os
|
||||
{
|
||||
$win10 = "Microsoft Windows 10"
|
||||
$win11 = "Microsoft Windows 11"
|
||||
$os = [string](Get-CimInstance Win32_OperatingSystem).Name
|
||||
|
||||
if ($os.Contains($win11))
|
||||
if ($IsWindows)
|
||||
{
|
||||
success "$win11 detected."
|
||||
$global:check += 1
|
||||
$win10 = "Microsoft Windows 10"
|
||||
$win11 = "Microsoft Windows 11"
|
||||
$os = [string](Get-CimInstance Win32_OperatingSystem).Name
|
||||
|
||||
if ($os.Contains($win11))
|
||||
{
|
||||
success "$win11 detected."
|
||||
$global:check += 1
|
||||
}
|
||||
elseif ($os.Contains($win10))
|
||||
{
|
||||
success "$win10 detected."
|
||||
$global:check += 1
|
||||
}
|
||||
}
|
||||
elseif ($os.Contains($win10))
|
||||
elseif ($IsMacOS)
|
||||
{
|
||||
success "$win10 detected."
|
||||
error "Operating System is not supported yet."
|
||||
}
|
||||
elseif ($IsLinux)
|
||||
{
|
||||
success "Linux detected."
|
||||
$global:check += 1
|
||||
}
|
||||
else
|
||||
{
|
||||
error "Operating System is not supported."
|
||||
error "Couldn't detect Operating System."
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
|
@ -169,19 +181,21 @@ function uninstall
|
|||
# Handle commandline arguments
|
||||
if ($args.Count -eq 1)
|
||||
{
|
||||
if ($args[0].ToString().ToLower() -eq "getkey")
|
||||
$arg = $args[0].ToString().ToLower()
|
||||
|
||||
if ($arg -eq "getkey")
|
||||
{
|
||||
getkey
|
||||
}
|
||||
elseif ($args[0].ToString().ToLower() -eq "update")
|
||||
elseif ($arg -eq "update")
|
||||
{
|
||||
update
|
||||
}
|
||||
elseif ($args[0].ToString().ToLower() -eq "backup")
|
||||
elseif ($arg -eq "backup")
|
||||
{
|
||||
backup
|
||||
}
|
||||
elseif ($args[0].ToString().ToLower() -eq "uninstall")
|
||||
elseif ($arg -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"
|
||||
|
|
Loading…
Add table
Reference in a new issue