diff --git a/example-scripts/powershell/runLTAonLinux.ps1 b/example-scripts/powershell/runLTAonLinux.ps1 index 8b35fa1..20ead40 100644 --- a/example-scripts/powershell/runLTAonLinux.ps1 +++ b/example-scripts/powershell/runLTAonLinux.ps1 @@ -3,18 +3,45 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. -#this scripts downloads and prepares Lemontree.Automation on a Linux machine. +#This scripts downloads and prepares Lemontree.Automation on a Linux machine. $LemonTreePackageURL = "https://nexus.lieberlieber.com/repository/lemontree-release/LemonTree.Automation/LemonTree.Automation.Linux.Zip_latest.zip" +$LemonTreeZip = "LTA.zip" +$DestinationPath = "./LTA/" +$LemonTreeExe = "./LTA/lemontree.automation" -Write-Output "Download LemonTree.Automtion from Repo" -Invoke-WebRequest -URI "$LemonTreePackageURL" -OutFile "LTA.zip" -Expand-Archive "LTA.zip" -DestinationPath ".\LTA\" -Force +Write-Output "Downloading LemonTree.Automation from Nexus..." -$LemonTreeExe = "./LTA/lemontree.automation" -#workaround because github artifacts logic doesn't maintain properties -chmod +x $LemonTreeExe +try { + # Attempt to download the file + Invoke-WebRequest -URI $LemonTreePackageURL -OutFile $LemonTreeZip -ErrorAction Stop + Write-Output "Download successful." +} catch { + Write-Output "Error: Failed to download LemonTree.Automation. $_" + exit 1 +} -Write-Output "LemonTreeAutomationExecutable=$LemonTreeExe" +Write-Output "Extracting $LemonTreeZip..." + +try { + # Attempt to extract the archive + Expand-Archive -Path $LemonTreeZip -DestinationPath $DestinationPath -Force -ErrorAction Stop + Write-Output "Extraction successful." +} catch { + Write-Output "Error: Failed to extract $LemonTreeZip. $_" + exit 1 +} +Write-Output "Setting executable permissions for $LemonTreeExe..." + +try { + # Attempt to set executable permissions + chmod +x $LemonTreeExe + Write-Output "Permissions set successfully." +} catch { + Write-Output "Error: Failed to set executable permissions for $LemonTreeExe. $_" + exit 1 +} + +Write-Output "LemonTreeAutomationExecutable=$LemonTreeExe" exit 0