Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: keys, update on start, autodetect mission, beta branch #31

Merged
merged 5 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 8 additions & 35 deletions src/.configs/lfa.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,31 @@
ServerAffinity = 5
HeadlessAffinity = 10

Hostname = '[FR] NE-VOYENNI | LFA | www.gsri.team'
Password = 'vyborg'
Hostname = '[FR] | www.gsri.team'
Password = ''
Players = 32
VerifySignatures = $false
Update = $true
Headless = $true
Headless = $false
DisableChannels = @()
Beta = 'creatordlc'

Admins = @(
76561197967609383 # Arwyn
)

Mods = @(
583496184
450814997
843425103
843577117
1779063631
463939057
2822052002
843632231
843593391
894678801
2018593688
2699465073
333310405
623475643
1923321700
2178398365
2162043396
1926513010
2034767030
773131200
773125288
2753746058
2899715306
905191399
2841411653
2145354279
)
ClientMods = @(
)
ServerMods = @(
)

Mission = @{
Type = 'Local'
Path = 'C:\Arma3\instances\lfa\mission'
}

WorkshopPath = 'C:\Arma3'
MasterPath = 'C:\Arma3\instances\lfa\master'
ConfigPath = 'C:\Arma3\instances\lfa\config'
ProfilePath = 'C:\Arma3\instances\lfa\profile'

Missions = @(
'C:\Arma3\instances\lfa\mission'
)
}
20 changes: 1 addition & 19 deletions src/ArmaServer-InstallBohemiaKeys.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,9 @@ param (

[Parameter()]
[string]
$WorkshopPattern = '^[0-9]+$',

[Parameter()]
[uri]
$OfficialKeysUri = 'https://arma.gsri.team/legacy/keys.zip'
$WorkshopPattern = '^[0-9]+$'
)

Begin {
Write-Verbose "Removing old keys from $DestinationPath"
New-Item $DestinationPath -ItemType Directory -Force | Out-Null
Get-ChildItem -Recurse -Filter *.bikey $DestinationPath | Remove-Item -Force
}

Process {
$AddonPath = switch ($true) {
($AddonName -match $WorkshopPattern) {
Expand All @@ -43,11 +33,3 @@ Process {
Write-Verbose "Copy addon keys from $AddonPath"
Get-ChildItem $AddonPath -Recurse -Filter '*.bikey' | Copy-Item -Destination $DestinationPath
}

End {
$KeysZip = New-TemporaryFile
Write-Verbose "Download official BI keys from $OfficialKeysUri"
Invoke-WebRequest -Uri $OfficialKeysUri -OutFile $KeysZip
Expand-Archive -Path $KeysZip -DestinationPath $DestinationPath
Remove-Item -Force $KeysZip
}
5 changes: 5 additions & 0 deletions src/ArmaServer-InstallConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ $Config = Import-PowerShellDataFile $ConfigFilename
$TemplatePath = Join-Path $MyInvocation.MyCommand.Module.ModuleBase .templates
$BasicFilePath = Join-Path $Config.ConfigPath basic.cfg
$ServerFilePath = Join-Path $Config.ConfigPath server.cfg
$MissionsPath = Join-Path $Config.MasterPath mpmissions
if($null -eq $Config.DefaultMission) {
$Config.DefaultMission = (Get-ChildItem $MissionsPath -Filter *.pbo | Select-Object -First 1).BaseName
Write-Verbose "Default mission not set, detected: $($Config.DefaultMission)"
}

# Initiliaze configuration
Write-Verbose "Removing old configurations from $($Config.ConfigPath)"
Expand Down
8 changes: 6 additions & 2 deletions src/ArmaServer-InvokeDownload.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ param (

[Parameter()]
[string]
$WorkshopPattern = '^[0-9]+$'
$WorkshopPattern = '^[0-9]+$',

[Parameter()]
[string]
$Beta
)

Begin {
Expand All @@ -45,7 +49,7 @@ End {
}

If ($PSCmdlet.ShouldProcess("$CommandsFilename", 'steamcmd runscript')) {
'app_update 233780 validate' | ArmaServer-InvokeSteamCmd -Path $MasterPath -Quit -Username $Username
"app_update 233780 -beta ${Beta} validate" | ArmaServer-InvokeSteamCmd -Path $MasterPath -Quit -Username $Username
Get-Content -Raw $CommandsFilename | ArmaServer-InvokeSteamCmd -Path $WorkshopPath -Quit:$Quit -Username $Username
}

Expand Down
4 changes: 3 additions & 1 deletion src/Install-ArmaServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ End {
Stop-ArmaServer -ConfigFilename $ConfigFilename
New-Item $Config.MasterPath -ItemType Directory -Force | Out-Null
New-Item $Config.WorkshopPath -ItemType Directory -Force | Out-Null
$Addons | ArmaServer-InvokeDownload -MasterPath $Config.MasterPath -WorkshopPath $Config.WorkshopPath -Quit
New-Item $KeysPath -ItemType Directory -Force | Out-Null
Get-ChildItem -Recurse -Filter *.bikey $KeysPath | Remove-Item -Force
$Addons | ArmaServer-InvokeDownload -MasterPath $Config.MasterPath -WorkshopPath $Config.WorkshopPath -Beta $Config.Beta -Quit
$Addons | ArmaServer-InstallBohemiaKeys -DestinationPath $KeysPath -WorkshopPath $Config.WorkshopPath
$Config.Missions | ArmaServer-InstallMission -DestinationPath $MissionsPath
ArmaServer-InstallConfig -ConfigFilename $ConfigFilename
Expand Down
22 changes: 5 additions & 17 deletions src/Start-ArmaServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,9 @@ param (
$ConfigFilename
)

Begin {
$Config = Import-PowerShellDataFile $ConfigFilename
$TranscriptPath = Join-Path $Config.ProfilePath pslogs
Start-Transcript -OutputDirectory $TranscriptPath
}

Process {
Stop-ArmaServer -ConfigFilename $ConfigFilename
Install-ArmaServer -ConfigFilename $ConfigFilename
ArmaServer-InvokeServerProcess -ConfigFilename $ConfigFilename
if ($Config.Headless) {
ArmaServer-InvokeHeadlessProcess -ConfigFilename $ConfigFilename
}
}

End {
Stop-Transcript
$Config = Import-PowerShellDataFile $ConfigFilename
Stop-ArmaServer -ConfigFilename $ConfigFilename
ArmaServer-InvokeServerProcess -ConfigFilename $ConfigFilename
if ($Config.Headless) {
ArmaServer-InvokeHeadlessProcess -ConfigFilename $ConfigFilename
}