247 lines
6.1 KiB
PowerShell
247 lines
6.1 KiB
PowerShell
# Esegue setup versione richiesta di BeamWall da repo Artifacts
|
||
|
||
Write-Output "-----------------------------"
|
||
Write-Output "- EgtBeamWall "
|
||
Write-Output "-----------------------------"
|
||
Write-Output ""
|
||
Write-Output ""
|
||
|
||
$rPath = "\\10.74.82.50\EgtTech\"
|
||
$rUser = "10.74.82.50\Server"
|
||
$rPwd = "Dossena"
|
||
$zPath = "\\truenas\Artifacts\EgtProg\EgtBEAMWALL"
|
||
$zPathC = "\\truenas\Artifacts\EgtProg\EgtBEAMWALL_Config"
|
||
$progPath = "C:\EgtTestProg\EgtBEAMWALL"
|
||
$dataPath = "C:\EgtTestData"
|
||
$arch64 =""
|
||
$branch =""
|
||
$APP_NAME = "c:\EgtTestProg\EgtCAM5"
|
||
|
||
$Folder1 = 'c:\EgtTestProg'
|
||
$Folder2 = 'c:\EgtTestData'
|
||
|
||
"Test to see if folder [$Folder1] exists"
|
||
if (Test-Path -Path $Folder1) {
|
||
"Prog esiste!"
|
||
#rm -Recurse $Folder1\*.*
|
||
} else {
|
||
new-item c:\EgtTestProg\EgtBEAMWALL -itemtype directory
|
||
}
|
||
|
||
if (Test-Path -Path $Folder2) {
|
||
"Data esiste!"
|
||
#rm -Recurse $Folder2\*.*
|
||
} else {
|
||
new-item c:\EgtTestData\EgtBEAMWALL -itemtype directory
|
||
}
|
||
|
||
|
||
if ([System.IO.Directory]::Exists('V:\')) {
|
||
"Path exists!"
|
||
} else {
|
||
$secpasswd = ConvertTo-SecureString "Dossena" -AsPlainText -Force
|
||
$mycreds = New-Object System.Management.Automation.PSCredential ("10.74.82.50\Server", $secpasswd)
|
||
New-SmbMapping -LocalPath 'V:' -RemotePath '\\10.74.82.50\EgtTech' -Username '10.74.82.50\Server' -Password 'Dossena'
|
||
}
|
||
|
||
if ([System.IO.Directory]::Exists('U:\')) {
|
||
"Path exists!"
|
||
} else {
|
||
$secpasswd = ConvertTo-SecureString "Egalware_24068!" -AsPlainText -Force
|
||
$mycreds = New-Object System.Management.Automation.PSCredential ("steamw\egalware", $secpasswd)
|
||
New-SmbMapping -LocalPath 'U:' -RemotePath '\\10.74.82.201\Artifacts' -Username 'steamw\egalware' -Password 'Egalware_24068!'
|
||
}
|
||
|
||
$Folder5 = 'c:\EgtTestData\EgtBEAMWALL\Fonts'
|
||
if (Test-Path -Path $Folder5) {
|
||
"Font esiste!"
|
||
rm -Recurse $Folder5\*.*
|
||
} else {
|
||
new-item c:\EgtTestData\EgtBEAMWALL\Fonts -itemtype directory
|
||
}
|
||
|
||
$Folder6 = 'c:\EgtTestData\EgtBEAMWALL\Temp'
|
||
if (Test-Path -Path $Folder6) {
|
||
"Temp esiste!"
|
||
rm -Recurse $Folder6\*.*
|
||
} else {
|
||
new-item c:\EgtTestData\EgtBEAMWALL\Temp -itemtype directory
|
||
}
|
||
|
||
$Folder7 = 'c:\EgtTestData\EgtBEAMWALL\Config'
|
||
if (Test-Path -Path $Folder7) {
|
||
"Config esiste!"
|
||
rm -Recurse $Folder7\*.*
|
||
} else {
|
||
new-item c:\EgtTestData\Fonts -itemtype directory
|
||
}
|
||
|
||
# ora chiedo quale branch scegliere
|
||
Write-Output ""
|
||
$valOk = $false
|
||
$altern = Get-ChildItem -Path $zPath -Directory
|
||
$numFolder = $altern.Count
|
||
|
||
do{
|
||
$idx = 1
|
||
Write-Output "-----------------------------"
|
||
foreach($item in $altern)
|
||
{
|
||
Write-Output("$idx - $item")
|
||
$idx++
|
||
}
|
||
Write-Output "-----------------------------"
|
||
Write-Output ""
|
||
Write-Output ""
|
||
$branch = @(Get-ChildItem $zPath -Directory | Out-GridView -Title 'Scegli il branch' -PassThru)
|
||
$valOk = ($numSel -le $numFolder)
|
||
|
||
} while(!$valOk)
|
||
|
||
|
||
|
||
#$valOk = $false
|
||
#do{
|
||
# $arch64 = Read-Host "Vuoi Architettura 64 bit (s/n)"
|
||
# $valOk = ($arch64.ToUpper() -eq "N" -or $arch64.ToUpper() -eq "S")
|
||
#} while(!$valOk)
|
||
|
||
#Write-Output "64 bit: $arch64"
|
||
|
||
# ora chiedo quale variante vuole
|
||
Write-Output ""
|
||
$valOk = $false
|
||
$altern = Get-ChildItem -Path $zPath -Directory
|
||
$numFolder = $altern.Count
|
||
|
||
#do{
|
||
# $idx = 1
|
||
# Write-Output "-----------------------------"
|
||
# foreach($item in $altern)
|
||
# {
|
||
# Write-Output("$idx - $item")
|
||
# $idx++
|
||
# }
|
||
# Write-Output "-----------------------------"
|
||
# Write-Output ""
|
||
# Write-Output ""
|
||
# $choice = @(Get-ChildItem $zPath\$branch | Out-GridView -Title 'Scegli architettura x64 o x32' -PassThru)
|
||
# Write-Output "$choice"
|
||
# $valOk = ($numSel -le $numFolder)
|
||
#
|
||
#} while(!$valOk)
|
||
|
||
function Show-MenuA
|
||
{
|
||
param (
|
||
[string]$Title = 'Seleziona Architettura da testare'
|
||
)
|
||
Clear-Host
|
||
Write-Host "================ $Title ================"
|
||
|
||
Write-Host "1: Premi '1' per x86"
|
||
Write-Host "2: Premi '2' per x64"
|
||
Write-Host "q: Premi 'q' per uscire dal programma."
|
||
}
|
||
|
||
Show-MenuA –Title 'Seleziona Architettura da testare'
|
||
|
||
$selection = Read-Host "Seleziona"
|
||
switch ($selection)
|
||
{
|
||
'1' {
|
||
$choice = 'x86'
|
||
'Hai scelto 32'
|
||
} '2' {
|
||
$choice = 'x64'
|
||
'Hai scelto 64'
|
||
} 'q' {
|
||
return
|
||
}
|
||
}
|
||
|
||
#function Show-Menu
|
||
#{
|
||
# param (
|
||
# [string]$Title = 'Seleziona Architettura Lualibs'
|
||
# )
|
||
# Clear-Host
|
||
# Write-Host "================ $Title ================"
|
||
#
|
||
# Write-Host "1: Premi '1' per 32"
|
||
# Write-Host "2: Premi '2' per 64"
|
||
# Write-Host "q: Premi 'q' per uscire dal programma."
|
||
#}
|
||
#
|
||
#Show-Menu –Title 'Seleziona Architettura Lualibs'
|
||
#
|
||
#$selection = Read-Host "Seleziona"
|
||
# switch ($selection)
|
||
# {
|
||
# '1' {
|
||
# $choiceL = '32'
|
||
# 'Hai scelto 32'
|
||
# } '2' {
|
||
# $choiceL = '64'
|
||
# 'Hai scelto 64'
|
||
# } 'q' {
|
||
# return
|
||
# }
|
||
# }
|
||
|
||
# function Show-MenuC
|
||
#{
|
||
# param (
|
||
# [string]$Title = 'Seleziona Architettura Librerie C'
|
||
# )
|
||
# Clear-Host
|
||
# Write-Host "================ $Title ================"
|
||
#
|
||
# Write-Host "1: Premi '1' per 32"
|
||
# Write-Host "2: Premi '2' per 64"
|
||
# Write-Host "q: Premi 'q' per uscire dal programma."
|
||
#}
|
||
#
|
||
#Show-MenuC –Title 'Seleziona Architettura Librerie C'
|
||
#
|
||
#$selection2 = Read-Host "Seleziona"
|
||
# switch ($selection2)
|
||
# {
|
||
# '1' {
|
||
# $choiceC = 'Dll32'
|
||
# 'Hai scelto 32'
|
||
# } '2' {
|
||
# $choiceC = 'Dll64'
|
||
# 'Hai scelto 64'
|
||
# } 'q' {
|
||
# return
|
||
# }
|
||
# }
|
||
|
||
if($choice -eq 'x86'){
|
||
$choiceL = '32'
|
||
$choiceC = 'Dll32'
|
||
}else {
|
||
$choiceL = '64'
|
||
$choiceC = 'Dll64'
|
||
}
|
||
|
||
|
||
#$choiceL = @(Get-ChildItem V:\EgtProg\LuaLibs\ | Out-GridView -Title 'Scegli architettura Lualibs' -PassThru)
|
||
|
||
#$choiceC = @(Get-ChildItem V:\EgtProg\ | Out-GridView -Title 'Scegli architettura Librerie C' -PassThru)
|
||
|
||
ROBOCOPY /E U:\EgtProg\EgtBEAMWALL\$branch\$choice $progPath
|
||
|
||
ROBOCOPY /E U:\EgtProg\EgtBEAMWALL_Config\Config $dataPath\EgtBEAMWALL\Config
|
||
|
||
ROBOCOPY /E V:\EgtProg\LuaLibs\$choiceL $dataPath\Lualibs
|
||
|
||
ROBOCOPY /E U:\EgtProg\EgtBEAMWALL_Config $progPath DataRoot.ini
|
||
|
||
ROBOCOPY /E V:\EgtProg\$choiceC $progPath
|
||
|
||
#ROBOCOPY /E Z:\EgtData\Messages $dataPath\EgtBEAMWALL\Config
|
||
|
||
ROBOCOPY /E V:\EgtProg\Fonts $Folder5
|