mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Nuitka is not able to handle all of our dependencies correctly,
so instead we're using anaconda which is essentially portable
python in single directory, that we can use to simply pip intsall
everything we need, pack it up and create an installer with inno
setup.
Currently, to build on windows(and for windows) you need to only
have Inno Setup 5 installed(no need for python!) and simply run
build.cmd from your prompt. It will automatically download latest
miniconda and produce dvc-{version}.exe in project's root.
Use dvc-{version}.exe to distribute dvc as a standalone application.
It doesn't require anything from user, everything it needs is provided
by our installer.
63 lines
2.3 KiB
PowerShell
63 lines
2.3 KiB
PowerShell
function addSymLinkPermissions($accountToAdd){
|
|
Write-Host "Checking SymLink permissions.."
|
|
$sidstr = $null
|
|
try {
|
|
$ntprincipal = new-object System.Security.Principal.NTAccount "$accountToAdd"
|
|
$sid = $ntprincipal.Translate([System.Security.Principal.SecurityIdentifier])
|
|
$sidstr = $sid.Value.ToString()
|
|
} catch {
|
|
$sidstr = $null
|
|
}
|
|
Write-Host "Account: $($accountToAdd)" -ForegroundColor DarkCyan
|
|
if( [string]::IsNullOrEmpty($sidstr) ) {
|
|
Write-Host "Account not found!" -ForegroundColor Red
|
|
exit -1
|
|
}
|
|
Write-Host "Account SID: $($sidstr)" -ForegroundColor DarkCyan
|
|
$tmp = [System.IO.Path]::GetTempFileName()
|
|
Write-Host "Export current Local Security Policy" -ForegroundColor DarkCyan
|
|
secedit.exe /export /cfg "$($tmp)"
|
|
$c = Get-Content -Path $tmp
|
|
$currentSetting = ""
|
|
foreach($s in $c) {
|
|
if( $s -like "SECreateSymbolicLinkPrivilege*") {
|
|
$x = $s.split("=",[System.StringSplitOptions]::RemoveEmptyEntries)
|
|
$currentSetting = $x[1].Trim()
|
|
}
|
|
}
|
|
if( $currentSetting -notlike "*$($sidstr)*" ) {
|
|
Write-Host "Need to add permissions to SymLink" -ForegroundColor Yellow
|
|
|
|
Write-Host "Modify Setting ""Create SymLink""" -ForegroundColor DarkCyan
|
|
|
|
if( [string]::IsNullOrEmpty($currentSetting) ) {
|
|
$currentSetting = "*$($sidstr)"
|
|
} else {
|
|
$currentSetting = "*$($sidstr),$($currentSetting)"
|
|
}
|
|
Write-Host "$currentSetting"
|
|
$outfile = @"
|
|
[Unicode]
|
|
Unicode=yes
|
|
[Version]
|
|
signature="`$CHICAGO`$"
|
|
Revision=1
|
|
[Privilege Rights]
|
|
SECreateSymbolicLinkPrivilege = $($currentSetting)
|
|
"@
|
|
$tmp2 = [System.IO.Path]::GetTempFileName()
|
|
Write-Host "Import new settings to Local Security Policy" -ForegroundColor DarkCyan
|
|
$outfile | Set-Content -Path $tmp2 -Encoding Unicode -Force
|
|
Push-Location (Split-Path $tmp2)
|
|
try {
|
|
secedit.exe /configure /db "secedit.sdb" /cfg "$($tmp2)" /areas USER_RIGHTS
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
} else {
|
|
Write-Host "NO ACTIONS REQUIRED! Account already in ""Create SymLink""" -ForegroundColor DarkCyan
|
|
Write-Host "Account $accountToAdd already has permissions to SymLink" -ForegroundColor Green
|
|
return $true;
|
|
}
|
|
}
|