Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
DexterDreeeam committed Mar 2, 2023
1 parent 750c9e0 commit 6125984
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion agent/one-line-installer-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $PackagesPath = $RootPath + "\Packages"
$AndroidRoot = $PackagesPath + "\Android"
$Urls = @{}
$Arch = $null
$AgentServiceName = "Hydra Lab Agent Service"

# =======================================
# Functions
Expand Down Expand Up @@ -198,7 +199,6 @@ if (Test-Path -Path $RootPath)
{
Remove-Item $RootPath -Recurse
}
[void](New-Item -Path $RootPath -ItemType Directory)

# =======================================
# Copy Configuration File
Expand All @@ -207,6 +207,7 @@ if (-Not(Test-Path -Path "$CurrentPath\application.yml"))
{
throw "Not found configuration file $CurrentPath\application.yml"
}
[void](New-Item -Path $RootPath -ItemType Directory)
Copy-Item "$CurrentPath\application.yml" -Destination "$RootPath\application.yml"

# =======================================
Expand Down Expand Up @@ -311,3 +312,12 @@ Set-EnvironmentVar -Key "ANDROID_PLATFORM_TOOLS" -Val "%ANDROID_HOME%\platform
Add-EnvironmentVar -Key "PATH" -Val "%ANDROID_HOME%"
Add-EnvironmentVar -Key "PATH" -Val "%ANDROID_CMDLINE_TOOLS%"
Add-EnvironmentVar -Key "PATH" -Val "%ANDROID_PLATFORM_TOOLS%"

$AgentServiceXml = Get-Content -Path "$RootPath\AgentService.xml"
$AgentServiceXml = $AgentServiceXml -replace "java","$JDK_Root\bin\java.exe"
$AgentServiceXml = $AgentServiceXml -replace "{LOG_FILE_LOCATION}","Logs"
$AgentServiceXml | Set-Content -Path "$RootPath\AgentService.xml"

sc.exe delete $AgentServiceName
New-Service -Name $AgentServiceName -BinaryPathName "$RootPath\AgentService.exe"
Start-Service -Name $AgentServiceName

0 comments on commit 6125984

Please sign in to comment.