Skip to content

Commit

Permalink
Merge pull request #645 from mcneel/AndyPayne/UpdateScript
Browse files Browse the repository at this point in the history
updating rhino.compute update script
  • Loading branch information
andyopayne committed Feb 2, 2024
2 parents 661916f + 221068b commit a83ab32
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
Binary file modified script/production/bootstrap_step-2.zip
Binary file not shown.
3 changes: 0 additions & 3 deletions script/production/bootstrap_step-2/module_iis_configure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ $websiteName = "Rhino.Compute"
$physicalPathRoot = "C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319"
$rhinoComputePath = "$physicalPathRoot\rhino.compute"
$computeGeometryPath = "$physicalPathRoot\compute.geometry"
$rhinoPackagesPath = "C:\ProgramData\McNeel\Rhinoceros\packages"
$userPackagesPath = "C:\Users\$env:UserName\AppData\Roaming\McNeel\Rhinoceros\packages"
$appPoolPackagesPath = "C:\Users\RhinoComputeAppPool\AppData\Roaming\McNeel\Rhinoceros"
$localUserName = "RhinoComputeUser"

Import-Module WebAdministration
Expand Down
39 changes: 30 additions & 9 deletions script/production/module_update_compute.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
$physicalPathRoot = "C:\inetpub\wwwroot\aspnet_client\system_web\4_0_30319"
$rhinoComputePath = "$physicalPathRoot\rhino.compute"
$computeGeometryPath = "$physicalPathRoot\compute.geometry"
$rhinoComputeExe = "$rhinoComputePath\rhino.compute.exe"
$computeGeometryExe = "$computeGeometryPath\compute.geometry.exe"
$appPoolName = "RhinoComputeAppPool"
$websiteName = "Rhino.Compute"

#Region funcs
Expand Down Expand Up @@ -33,13 +36,27 @@ Write-Host @"
# # # # # # # # # # # # # # # # # # # # #
"@

# check that compute exists
if (((Test-Path "$computeGeometryExe") -eq $false) -or ((Test-Path "$rhinoComputeExe") -eq $false)) {
Write-Host "The rhino.compute or compute.geometry executable file could not be found." -ForegroundColor Red
Write-Host "Please run the bootstrap script first!" -ForegroundColor Red
exit 1
}

Write-Step "Stopping any IIS services that are running"
net stop was /y

if ((Test-Path -Path $physicalPathRoot)) {
Write-Step "Removing any existing Rhino.Compute build directories"
Remove-Item -LiteralPath $physicalPathRoot -Force -Recurse
Write-Step 'Create backup'
$backupDir = "$physicalPathRoot\rhino.compute-backup"
if ((Test-Path "$backupDir") -eq $true) {
Write-Host "Deleting '$backupDir'"
Remove-Item -Recurse -Force "$backupDir"
}
New-Item -ItemType Directory -Force -Path $backupDir
Write-Host "Moving $rhinoComputePath to $backupDir\rhino.compute"
Move-Item -Path $rhinoComputePath -Destination $backupDir
Write-Host "Moving $computeGeometryPath to $backupDir\compute.geometry"
Move-Item -Path $computeGeometryPath -Destination $backupDir

$gitPrefix = 'https://api.github.com/repos'
$nightlyPrefix = 'https://nightly.link'
Expand Down Expand Up @@ -67,17 +84,21 @@ if ($artifactID -lt 0){

$downloadurl = "$nightlyPrefix/$actionurl/$artifactID.zip"

if (-Not (Test-Path -Path $appDirectory)){
New-Item $appDirectory -ItemType Directory
if (-Not (Test-Path -Path $physicalPathRoot)){
New-Item $physicalPathRoot -ItemType Directory
}

if ((Test-Path $appDirectory)) {
if ((Test-Path $physicalPathRoot)) {
Write-Step "Download and unzip latest build of compute from $downloadurl"
Download $downloadurl "$appDirectory/compute.zip"
Expand-Archive "$appDirectory/compute.zip" -DestinationPath $appDirectory
Remove-Item "$appDirectory/compute.zip"
Download $downloadurl "$physicalPathRoot/compute.zip"
Expand-Archive "$physicalPathRoot/compute.zip" -DestinationPath $physicalPathRoot
Remove-Item "$physicalPathRoot/compute.zip"
}

Write-Step "Granting application pool permissions on compute directories"
cmd /c icacls $rhinoComputePath /grant ("IIS AppPool\$appPoolName" + ':(OI)(CI)F') /t /c /q
cmd /c icacls $computeGeometryPath /grant ("IIS AppPool\$appPoolName"+ ':(OI)(CI)F') /t /c /q

Write-Step "Starting the IIS Service"
net start w3svc
Start-IISSite -Name $websiteName

0 comments on commit a83ab32

Please sign in to comment.