Skip to content

Commit 938f93f

Browse files
committed
2 parents cf5bbed + 7a50bce commit 938f93f

1 file changed

Lines changed: 54 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,62 @@ jobs:
6464
6565
Write-Host "Set AppVersion to $ver and AppVersion_ to $verUnderscore in OpenServerPanel.iss"
6666
67+
- name: Prepare PostgreSQL data dirs (reset ACL and owner)
68+
shell: pwsh
69+
run: |
70+
$ErrorActionPreference = 'Stop'
71+
72+
function Reset-AclRecursive {
73+
param([string]$Path)
74+
if (-not (Test-Path $Path)) { return }
75+
76+
# снять атрибуты
77+
attrib -r -h -s "$Path" /S /D 2>$null
78+
79+
# включить наследование временно
80+
icacls "$Path" /inheritance:e /T /C | Out-Null
81+
82+
# удалить и пересоздать
83+
try { Remove-Item "$Path" -Recurse -Force -ErrorAction SilentlyContinue } catch {}
84+
New-Item -ItemType Directory -Force -Path "$Path" | Out-Null
85+
86+
# отключить наследование и задать явные ACE
87+
icacls "$Path" /inheritance:d /T /C | Out-Null
88+
89+
$me = "$env:USERDOMAIN\$env:USERNAME"
90+
# Владелец: текущий пользователь
91+
takeown /F "$Path" /R /D Y | Out-Null
92+
cmd /c "icacls ""$Path"" /setowner ""$me"" /T /C" | Out-Null
93+
94+
# Полные права: текущий пользователь, SYSTEM, BUILTIN\Users
95+
icacls "$Path" /grant:r "${me}:(OI)(CI)F" /T /C | Out-Null
96+
icacls "$Path" /grant:r "*S-1-5-18:(OI)(CI)F" /T /C | Out-Null # SYSTEM
97+
icacls "$Path" /grant:r "*S-1-5-32-545:(OI)(CI)F" /T /C | Out-Null # BUILTIN\Users
98+
99+
# ещё раз снять атрибуты
100+
attrib -r -h -s "$Path" /S /D 2>$null
101+
}
102+
103+
$modules = Join-Path (Get-Location) 'modules'
104+
$pgVers = 11..17 | ForEach-Object { "PostgreSQL-$_" }
105+
foreach ($v in $pgVers) {
106+
$mod = Join-Path $modules $v
107+
$data = Join-Path $mod 'ospanel_data\default_data'
108+
$tmp = Join-Path $mod 'temp'
109+
Reset-AclRecursive -Path $data
110+
Reset-AclRecursive -Path $tmp
111+
}
112+
113+
Start-Sleep -Seconds 2
114+
67115
- name: Run generators (genall.ps1 and gendb.bat)
68116
shell: pwsh
117+
env:
118+
TMP: D:\a\_temp
119+
TEMP: D:\a\_temp
69120
run: |
121+
$ErrorActionPreference = 'Stop'
122+
if (-not (Test-Path $env:TEMP)) { New-Item -ItemType Directory -Force -Path $env:TEMP | Out-Null }
70123
Set-Location generate
71124
# Выполнить PowerShell-скрипт
72125
.\genall.ps1
@@ -88,4 +141,4 @@ jobs:
88141
uses: actions/upload-artifact@v4
89142
with:
90143
name: open-server-panel-setup
91-
path: release/*.exe
144+
path: release/*.exe

0 commit comments

Comments
 (0)