entrypoint.ps1 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. Set-PSDebug -Trace 1
  2. if (!$env:logshare) {
  3. write-host "LogShare must be defined"
  4. exit 1
  5. }
  6. if (!$env:filesshare) {
  7. write-host "FilesShare must be defined"
  8. exit 1
  9. }
  10. if (!$env:filespath) {
  11. write-host "FilesPath must be defined"
  12. exit 1
  13. }
  14. if ( (test-path("C:\ProgramData\Docker\secrets\shares.username")) -And (test-path("C:\ProgramData\Docker\secrets\shares.passwd")) ){
  15. $sh_username=Get-Content -path "C:\ProgramData\Docker\secrets\shares.username"
  16. $sh_passwd=Get-Content -path "C:\ProgramData\Docker\secrets\shares.passwd"
  17. New-SmbMapping -RemotePath $env:logpath -UserName $sh_username -Password $sh_passwd
  18. New-SmbMapping -RemotePath $env:filesshare -UserName $sh_username -Password $sh_passwd
  19. }
  20. else {
  21. New-SmbMapping -RemotePath $env:logpath
  22. New-SmbMapping -RemotePath $env:filesshare
  23. }
  24. new-item -ItemType SymbolicLink -path C:\Services\Analis -Name Log -value $env:logshare -Force
  25. new-item -ItemType SymbolicLink -path $env:filespath -Name Files -value $env:filesshare -Force
  26. if ( -Not (test-path("C:\Services\Analis\analis.conf")) ){
  27. move-item -path C:\Services\Analis\analis-default.conf -destination C:\Services\Analis\analis.conf
  28. }
  29. C:\Services\Analis\AnalisServer.exe $args