-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathdeployLocalBuild.ps1
83 lines (74 loc) · 6.42 KB
/
deployLocalBuild.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
$propertiesExist = Test-Path localDevDeploy.properties
$ErrorActionPreference = "Stop"
if ($propertiesExist -eq $true) {
Write-Host ""
Write-Host "Reading localDevDeploy.properties"
Write-Host ""
# Build the settings we will work with
$properties = Get-Content localDevDeploy.properties
$settings = @{""=""};
foreach ($line in $properties) {
$items = $line.Split("=")
$settings.Add($items[0], $items[1])
}
# Ensure we know what things to operate on
if($settings.ContainsKey("arma3Install") -eq $true -and $settings.ContainsKey("pboManagerInstall") -eq $true) {
$oldExists = Test-Path DUWS-R_dev.Altis.pbo
if($oldExists -eq $true) {
Remove-Item DUWS-R_dev.Altis.pbo
}
# Pack the folder
$command = """" + $settings["pboManagerInstall"] + "\PBOConsole.exe"" -pack .\source .\DUWS-R_dev.Altis.pbo"
Invoke-Expression "& $command"
# Ensure the SP destination exists
$dirSPPath = $settings["arma3Install"] + "\Missions"
$dirSPExists = Test-Path $dirSPPath
if($dirSPExists -eq $false){
New-Item $dirSPPath -type directory
}
# Ensure the SP destination is clear
$oldPath = $settings["arma3Install"] + "\Missions\DUWS-R_dev.Altis.pbo"
$oldExists = Test-Path $oldPath
if($oldExists -eq $true) {
Remove-Item $oldPath
}
# Pull other 'real' release out by renaming them to .bak
$tmp = $settings["arma3Install"] + "\Missions\"
$otherFiles = Get-ChildItem $tmp -filter "DUWS-R_*.pbo"
foreach ($file in $otherFiles){
if(-Not($file -eq "" -Or $file -eq $null)) {
Write-Host "Attemping to rename " - $tmp$file $(" to ") - $tmp$file.bak
Rename-Item "$tmp$file" "$tmp$file.bak"
}
}
Copy-Item DUWS-R_dev.Altis.pbo $oldPath
# Ensure the SP destination exists
$dirMPPath = $settings["arma3Install"] + "\MPMissions"
$dirMPExists = Test-Path $dirMPPath
if($dirMPExists -eq $false){
New-Item $dirMPPath -type directory
}
# Ensure the MP destination is clear
$oldPath = $settings["arma3Install"] + "\MPMissions\DUWS-R_dev.Altis.pbo"
$oldExists = Test-Path $oldPath
if($oldExists -eq $true) {
Remove-Item $oldPath
}
# Pull other 'real' release out by renaming them to .bak
$tmp = $settings["arma3Install"] + "\MPMissions\"
$otherFiles = Get-ChildItem $tmp -filter "DUWS-R_*.pbo"
if(-Not($file -eq "" -Or $file -eq $null)) {
Write-Host "Attemping to rename " - $tmp$file $(" to ") - $tmp$file.bak
Rename-Item "$tmp$file" "$tmp$file.bak"
}
Copy-Item DUWS-R_dev.Altis.pbo $oldPath
Remove-Item DUWS-R_dev.Altis.pbo
} else {
Write-Host "could not find arma3Install and pboManagerInstall keys in properties file"
}
Write-Host ""
} else {
Write-Host ""
Write-Host "Cannot find localDevDeploy.properties. Please create and configure the file then try again."
Write-Host ""
}